Bug: Control handle formula is lost after adding trapezoid shapes. Consequently, when the added shape is selected, its yellow control handle is at wrong position (compared with direct dragging into the drawing place).
public static void Test6_Trapezoid_WrongControlHandlePosition()
{
string[] inputFileNames = new string[] {
"_Trapezoid_ReSavedFromVSDX.vsd"
};
foreach (string inputFileName in inputFileNames)
{
Diagram diagram = new Diagram(@"data\" + inputFileName);
long shapeId = diagram.AddShape(5.0, 8.0, 2, 2, @"Trapezoid", 0);
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
shape.Text.Value.Add(new Txt(@"Trapezoid"));
// Save the new diagram
string outputDiagramPath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + inputFileName;
diagram.Save(outputDiagramPath + ".vsdx", SaveFileFormat.VSDX);
diagram.Save(outputDiagramPath + ".vdx", SaveFileFormat.VDX);
diagram.Save(outputDiagramPath + ".emf", SaveFileFormat.EMF);
}
}
Bug: Cannot assign fill color to the added trapezoid shape.
public static void Test7_Trapezoid_CannotAssignColor()
{
string[] inputFileNames = new string[] {
"_Trapezoid_ReSavedFromVSDX.vsd"
};
foreach (string inputFileName in inputFileNames)
{
Diagram diagram = new Diagram(@"data\" + inputFileName);
long shapeId = diagram.AddShape(5.0, 8.0, 2, 2, @"Trapezoid", 0);
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
shape.Fill.FillBkgnd.Value = "#c8c8c8";
shape.Text.Value.Add(new Txt(@"Trapezoid"));
// Save the new diagram
string outputDiagramPath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + inputFileName;
diagram.Save(outputDiagramPath + ".vsdx", SaveFileFormat.VSDX);
diagram.Save(outputDiagramPath + ".vdx", SaveFileFormat.VDX);
diagram.Save(outputDiagramPath + ".emf", SaveFileFormat.EMF);
}
}
Bug: Nothing is shown after the coordinate collection of the added shape is replaced. More specifically, (1) checking the Geometry rows of the ShapeSheet shows that the MoveTo call turns out to be a LineTo row, (2) manually changing the row type fails complaining invalid row tag, (3) clicking individual coordinate row shows that the vertexes are at the desired position, however the text is at the initial position, which is very confusing…
public static void Test8_Trapezoid_CannotReplaceCoordinates()
{
string[] inputFileNames = new string[] {
"_Trapezoid_ReSavedFromVSDX.vsd"
};
foreach (string inputFileName in inputFileNames)
{
Diagram diagram = new Diagram(@"data\" + inputFileName);
long shapeId = diagram.AddShape(5.0, 8.0, 2, 2, @"Trapezoid", 0);
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);
shape.Text.Value.Add(new Txt(@"Trapezoid"));
Geom geom = shape.Geoms[0];
geom.CoordinateCol.Clear();
//Add MoveTo
MoveTo moveTo = new MoveTo();
moveTo.IX = geom.NextCoordinateIX;
moveTo.X.Value = 2.2;
moveTo.Y.Value = 2.2;
geom.CoordinateCol.Add(moveTo);
//Add LineTo
LineTo lineTo = new LineTo();
lineTo.IX = geom.NextCoordinateIX;
lineTo.X.Value = 3.2;
lineTo.Y.Value = 2.2;
geom.CoordinateCol.Add(lineTo);
//Add LineTo
lineTo = new LineTo();
lineTo.IX = geom.NextCoordinateIX;
lineTo.X.Value = 2.8;
lineTo.Y.Value = 3.2;
geom.CoordinateCol.Add(lineTo);
//Add LineTo
lineTo = new LineTo();
lineTo.IX = geom.NextCoordinateIX;
lineTo.X.Value = 2.3;
lineTo.Y.Value = 3.2;
geom.CoordinateCol.Add(lineTo);
//Add LineTo
lineTo = new LineTo();
lineTo.IX = geom.NextCoordinateIX;
lineTo.X.Value = 2.2; // back to the origin
lineTo.Y.Value = 2.2;
geom.CoordinateCol.Add(lineTo);
// Save the new diagram
string outputDiagramPath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + inputFileName;
diagram.Save(outputDiagramPath + ".vsdx", SaveFileFormat.VSDX);
diagram.Save(outputDiagramPath + ".vdx", SaveFileFormat.VDX);
diagram.Save(outputDiagramPath + ".emf", SaveFileFormat.EMF);
}
}
Can you help to check the issues above ? Many thanks for your efforts !