svg transform matrix parser - parsing

problem explain:
transform = "matrix(cos(a), sin(a), -sin(a), cos(a), -x1cos(a)+y1sin(a)+x2, -x1sin(a)-y1cos(a)+y2)"
can see 7.4 Coordinate system transformations
to be resolved:
in my work,i must resolve to parse matrix
example:
<?xml version="1.0" encoding="utf-8"?><svg width="800" height="500" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:PerfectSVG="http://www.perfectsvg.com/PerfectSVG" xml:space="preserve">
<defs>
<symbol overflow="visible" id="symbol1" connectPoints="15 70 50 0 87 68">
<g>
<line x1="300" y1="200" x2="309" y2="200" transform="matrix(1,0,0,1,0,0)" />
<line x1="311" y1="200" x2="320" y2="200" transform="matrix(1,0,0,1,0,0)" />
<line x1="300" y1="200" x2="304.75" y2="207.75" transform="matrix(1,0,0,1,0,0)" />
<line x1="315.75" y1="207" x2="320" y2="200" transform="matrix(1,0,0,1,0,0)" />
<line x1="309.25" y1="197.5" x2="309.25" y2="202.25" transform="matrix(1,0,0,1,0,0)"/>
<line x1="311" y1="197.25" x2="311" y2="202.5" transform="matrix(1,0,0,1,0,0)"/>
<line x1="313.75" y1="205.5" x2="318" y2="208.5" transform="matrix(1,0,0,1,0,0)"/>
<line x1="302.75" y1="209.5" x2="307.25" y2="206" transform="matrix(1,0,0,1,0,0)"/>
<line x1="303.75" y1="211" x2="308.25" y2="207.5" transform="matrix(1,0,0,1,0,0)"/>
<line x1="306" y1="209.25" x2="310.25" y2="215.5" transform="matrix(1,0,0,1,0,0)"/>
<line x1="312.75" y1="207.25" x2="317.25" y2="210.5" transform="matrix(1,0,0,1,0,0)"/>
<line x1="310.25" y1="215.25" x2="314.5" y2="208.75" transform="matrix(1,0,0,1,0,0)"/>
</g>
</symbol></defs><use xlink:href="#symbol1" transform="matrix(3.774,-2.246,2.246,3.774,-1562.468,-12.947)" stroke="#000000" fill="#FFFFFF" id="use3" stroke-width="0.2276867"/></svg>
Now:
i want to know In:transform="matrix(3.774,-2.246,2.246,3.774,-1562.468,-12.947)" out:(a:angle x1,y1:The original coordinates x2,y2:New coordinates) from the example
who can give suggestions or Some reference materials
tks.

It's impossible to get old x/y and new x/y only by transform data.
You must have two of the three data.
You can use getBBox method to get the outer box, and then you can get the box's dots.

Related

SVG Vector Effect

I am trying to define a fixed stroke width into my SVG, similar to this thread.
In my devenv (VS 2017) I am running Edge and the project is targeting .net 4.6.1
The SVG is defined as:
<svg version="1.1"
baseProfile="full"
width="100%" height="Auto"
viewBox="0 0 #sheet.SheetShape.Bounds.Width #sheet.SheetShape.Bounds.Height"
xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="100%" stroke="red" fill="white" />
#foreach (var cut in sheet.SheetCuts)
{
<line vector-effect="non-scaling-stroke" stroke-width="2" stroke="black" stroke-dasharray="5, 5" x1=#cut.Start.X y1=#cut.Start.Y x2=#cut.End.X y2=#cut.End.Y />
}
The vector-effect property is not recognized by VS intellisense and when the code runs nothing special happens.
What should be wrong?

How to get method level coverage with gcovr?

I've been working with gcovr to generate coverage data for my whole project.
I am able to generate summary reports like this:
------------------------------------------------------------------------------
GCC Code Coverage Report
Directory: ...../src/
------------------------------------------------------------------------------
File Lines Exec Cover Missing
------------------------------------------------------------------------------
src/A/A1/xyz.cpp 1609 2 0% 97,99,101....
src/A/A2/abcg.cpp 271 4 1% .......
src/B/B1/mnop.cpp 74 2 2% 34,42,56-.....
src/B/B2/wrds.cpp 1533 6 0% 76,83,85-.....
src/C/C1/abcdefg.cpp 1079 8 0% 143,150,152.....
with total and everything else too, but this data is at source level. So I tried generating xml files which had the same kind of data in xml format. When I finally generated denser xml file with line level coverage like this one:
<class branch-rate="0.285714285714" complexity="0.0" filename="src/absc/mno/xyz/ahgs.cpp" line-rate="0.231481481481" name="os_clib_hxx">
<methods/>
<lines>
<line branch="false" hits="0" number="200"/>
<line branch="false" hits="0" number="202"/>
<line branch="false" hits="3" number="208"/>
<line branch="false" hits="3" number="210"/>
<line branch="false" hits="63" number="213"/>
<line branch="true" condition-coverage="50% (1/2)" hits="63" number="215">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="false" hits="0" number="218"/>
.........
..........
I still couldn't find anything method level.
I know it is possible with gcov to generate method level coverage for one file at a time, but that is not possible in my case as I am working with thousands of files, for which if I try to generate data for each of them by any method it would be problematic.
Unfortunately, gcovr is not currently able to report coverage on a per-function basis.
The XML report contains an empty <methods/> section because this section is required by the DTD schema for the Cobertura XML format, but it does not contain useful data. Similarly, other XML fields like complexity just contain dummy data.

ant.concat task translation to Gradle / Groovy

<concat destfile="${database_dir}/xxxx-create-constraints.sql">
<filelist dir="${database_dir}" files="XXXX-hsqldb-nodrop.sql" />
<filterchain>
<striplinebreaks />
<replacestring from=";" to=";
" />
<linecontains>
<contains value="add constraint" />
</linecontains>
</filterchain>
</concat>
<concat destfile="${database_dir}/XXXXX-drop-constraints.sql">
<filelist dir="${database_dir}" files="xxxx-hsqldb.sql" />
<filterchain>
<striplinebreaks />
<replacestring from=";" to=";
" />
<linecontains>
<contains value="drop constraint" />
</linecontains>
</filterchain>
</concat>
I am trying to translate this into Gradle, it is part of a larger task the majority of which I have already translated, I am having trouble with the following section.
<filterchain>
<striplinebreaks />
<replacestring from=";" to=";
" />
<linecontains>
<contains value="drop constraint" />
</linecontains>
</filterchain>
I can't find any examples or documentation on how this might look in Groovy.
Thus far I have just:
ant.concat(destFile:"${database_dir}/XXXX-create-constraints.sql"){
files("XXXX-hsqldb-nodrop.sql")
filelist(dir:"${database_dir}")
}
Any help or insight would be appreciated.
EDIT
I've nutted out a version though I'm not sure about correctness, just because its not throwing errors or breaking doesn't mean its right.
ant.concat(destFile:"${database_dir}/XXXX-create-constraints.sql"){
files("XXXX-hsqldb-nodrop.sql")
filelist(dir:"${database_dir}")
filterchain{
striplinebreaks()
replacestring(from:';', to:';
')
linecontains{
'add constraint'
}
}
}

Automatically change a field based on another in TFS

Is it possible to change a value of field based on the value of another field in TFS?
What I'm trying to do is, when the value of the Story Points field changes, update automatically another field with the correspondent T-Shirt size value.
For example, we are using power of 2 values to represent the story points;
So, for a 1 points story it would correspond a t-shirt value of XS, for a 2 points story a t-shirt value of S, and so on.
Is this possible?
Use a combination of WHEN conditions and COPY rules:
<FIELD name="StoryPoints Size" refname="Custom.StoryPoints.Size" type="String">
<WHEN field="Microsoft.VSTS.Scheduling.StoryPoints" value="1">
<COPY from="value" value="XS" />
</WHEN>
<WHEN field="Microsoft.VSTS.Scheduling.StoryPoints" value="2">
<COPY from="value" value="S" />
</WHEN>
<WHEN field="Microsoft.VSTS.Scheduling.StoryPoints" value="3">
<COPY from="value" value="M" />
</WHEN>
<WHEN field="Microsoft.VSTS.Scheduling.StoryPoints" value="4">
<COPY from="value" value="L" />
</WHEN>
<WHEN field="Microsoft.VSTS.Scheduling.StoryPoints" value="5">
<COPY from="value" value="XL" />
</WHEN>
</FIELD>
You'll find all you need here on the MSDN and more specifically the section called:
"Defining a Field When the User Changes Another Field (WHENCHANGED)".

Wpf animation - like shaking icons on iOS

I would like to have an image animation in wpf where the image shakes lightly in order to delete it, as it happens for apps in iOS.
Do you know something that would help ? Something that already built?
Thanks a lot.
Here's a complete sample of shaking the text of button. You should be able to adapt this to shake an image, and improve it using easing functions.
<Grid.Resources>
<ControlTemplate x:Key="ShakingButtonTemplate" TargetType="Button">
<Border Margin="5" BorderBrush="Aquamarine" BorderThickness="5" CornerRadius="5">
<ContentPresenter HorizontalAlignment="Center" Content="{TemplateBinding Content}">
<ContentPresenter.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="Position"/>
</TransformGroup>
</ContentPresenter.RenderTransform>
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="ShakeIt">
<Storyboard>
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="Position"
Storyboard.TargetProperty="X"
RepeatBehavior="5x"
>
<EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.20" Value="-2"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<!--
<DoubleAnimation
Storyboard.TargetName="Position"
Storyboard.TargetProperty="X"
From="-2" To="2"
Duration="0:0:0:0.1"
AutoReverse="True"
RepeatBehavior="10x">
</DoubleAnimation>
-->
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ShakingButton" TargetType="Button">
<Setter Property="Template" Value="{StaticResource ShakingButtonTemplate}"/>
</Style>
</Grid.Resources>
<StackPanel>
<Button Style="{StaticResource ShakingButton}" Content="This is a button" />
</StackPanel>

Resources