1 of 7

2 of 7

A

SVGElementArray returnElements = new SVGElementArray();

List<char> allCMD = new List<char>();

//transforming

string[] matricies = new string[0];

int numTransforms = attributeValues.atributes.Count

- allElementAttributes.path.Count();

//seporate the transform matricies from the other attributes

for (int transformNum = 0; transformNum < numTransforms; transformNum++)

{

Array.Resize(ref matricies, matricies.Length + 1);

matricies[transformNum] = attributeValues.atributes

[allElementAttributes.path.Count() + transformNum];

}

transformMatrix finalMatrix = transform.combineMatricies(matricies);

string dVal = attributeValues.atributes[0];

string[] seporateDVals = dVal.Split(new char[2] { ' ', ',' });

char CMD = ' ';

point handle0 = new point();

point handle1 = new point();

point startPoint = new point();

point currentPoint = new point();

point previousPoint = new point();

QuadCode quadCode = new QuadCode();

List<point> moveTos = new List<point>();

//going through the loop

for (int dValIndex = 0; dValIndex < seporateDVals.Length - 1; dValIndex++)

{

//look for a cmd

char firstChar = seporateDVals[dValIndex][0];

if (char.IsLetter(firstChar) == true)

{

CMD = firstChar;

if (seporateDVals[dValIndex].Length > 1)

{

seporateDVals[dValIndex] = seporateDVals[dValIndex].Substring(1);

}, currentPoint, matricies));

break;

case 'H': //horizontal line absolute

currentPoint.x = firstVal;

currentPoint.y = 0;

returnElements.SVGelement.Add(quadCode.addLine(previousPoint, currentPoint, matricies));

break;

case 'h': //horizontal line relative

currentPoint.x += firstVal;

returnElements.SVGelement.Add(quadCode.addLine(previousPoint, currentPoint, matricies));

break;

case 'V': //vertical line absolute

currentPoint.x = 0;

currentPoint.y = firstVal;

returnElements.SVGelement.Add(quadCode.addLine(previousPoint, currentPoint, matricies));

break;

case 'v': //vertical line relative

currentPoint.y += firstVal;

returnElements.SVGelement.Add(quadCode.addLine(previousPoint, currentPoint, matricies));

break;

case 'C': // Cubic bezier curve absolute

case 'S':

handle0.x = firstVal;

dValIndex++;

handle0.y = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

handle1.x = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

handle1.y = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.x = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.y = double.Parse(seporateDVals[dValIndex]);

returnElements.SVGelement.Add(quadCode.addCurve(previousPoint, handle0, handle1, currentPoint, matricies));

break;

case 'c': // Cubic bezier curve relative

case 's':

handle0.x = previousPoint.x + firstVal;

dValIndex++;

handle0.y = previousPoint.y + double.Parse(seporateDVals[dValIndex]);

dValIndex++;

handle1.x = previousPoint.x + double.Parse(seporateDVals[dValIndex]);

dValIndex++;

handle1.y = previousPoint.y + double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.x += double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.y += double.Parse(seporateDVals[dValIndex]);

returnElements.SVGelement.Add(quadCode.addCurve(previousPoint, handle0, handle1, currentPoint, matricies));

break;

case 'Q': // Cubic bezier curve absolute

case 'T':

handle0.x = firstVal;

dValIndex++;

handle0.y = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.x = double.Parse(seporateDVals[dValIndex]);

dValIndex++;

currentPoint.y = double.Parse(seporateDVals[dValIndex]);

returnElements.SVGelement.Add(quadCode.addCurve(previousPoint, handle0, handle0, currentPoint, matricies));

break;

case 'q': // Cubic bezier curve relative

case 't': case 'Z': //closing line to start point

case 'z':

returnElements.SVGelement.Add(quadCode.addLine(startPoint, currentPoint, matricies));

break;

}

previousPoint = currentPoint;

}

if (allCMD.Count == 2)

{

if (allCMD[0].ToString().ToUpper() == "M" & allCMD[1].ToString().ToUpper() == "Z")

{

return returnElements.SVGelement.Add(quadCode.addLine(startPoint, currentPoint, matricies));

break;

}

previousPoint = currentPoint;

}

if (allCMD.Count == 2)

{

if (allCMD[0].ToString().ToUpper() == "M" & allCMD[1].ToString().ToUpper() == "Z")

{

return Quadify.polylineToQuadLine(moveTos.ToArray(), matricies, true);

}

}

else if (allCMD.Count == 1)

{

if (allCMD[0].ToString().ToUpper() == "M")

{

return Quadify.polylineToQuadLine(moveTos.ToArray(), matricies, true);

}

}

return returnElements;

}

}

}

3 of 7

C#

Swift

JavaScript

A

4 of 7

5 of 7

var point = (x: 0, y: 1.25);

switch point {

case (0, 0):

Console.writeLine(“Your point lies at the origin (0, 0).”);

case (x, 0):

Console.writeLine(“Your point lies along the y axis line at (\(x), 0).”);

case (0, y):

Console.writeLine(“Your point lies along the x axis line at (0, \(y)).”);

case (1, 1), (2, 2), (3, 3):

Console.writeLine(“Your point lies at (1, 1), (2, 2), or (3, 3).”);

default:

Console.writeLine(“Your point lies somewhere in the coordinate space.”);

}

6 of 7

7 of 7

MAY 2017