Working on trying to convert visio diagram shapes to SVG paths. While looping through the shapes and the geometry data I noticed that the shapes always seemed to be coming in as the default values (same values as if you just dragged the Visio shape out). In the picture I marked that I changed all the values using the developer tools to 1 but while importing it still has the same value as the default. Is there something I am missing here? Is the data for how the geometry is transformed/manipulated somewhere else?
Code below is used to loop through the shape and make a list of SVG paths that can then be used to render the shape as an SVG. This is just the code for the cone shape.
public static void addSvgPathsForShape(Shape shape, List<String> path)
{
GeomCollection geomCollection = shape.getGeoms();
for (Geom geom : (Iterable<Geom>) geomCollection)
{
PathagonBuilder pathagonBuilder = new PathagonBuilder();
pathagonBuilder.moveTo(0.0, 0.0);
for (Coordinate coordinate : (Iterable<Coordinate>) geom.getCoordinateCol())
{
if (coordinate instanceof LineTo)
{
LineTo lineTo = (LineTo) coordinate;
double x = lineTo.getX().getValue();
double y = -lineTo.getY().getValue();
pathagonBuilder.lineTo(x, y);
}
else if (coordinate instanceof MoveTo)
{
MoveTo moveTo = (MoveTo) coordinate;
double x = moveTo.getX().getValue();
double y = -moveTo.getY().getValue();
pathagonBuilder.moveTo(x, y);
}
else if (coordinate instanceof EllipticalArcTo) {
EllipticalArcTo ellipticalArcTo = (EllipticalArcTo) coordinate;
double arcX = ellipticalArcTo.getA().getValue();
double arcY = -ellipticalArcTo.getB().getValue();
double endX = ellipticalArcTo.getX().getValue();
double endY = -ellipticalArcTo.getY().getValue();
pathagonBuilder.ellipticalArcTo(arcX, Math.abs(arcY-endY), ellipticalArcTo.getC().getValue(), false, false, endX, endY);
}
}
pathagonBuilder.closePath();
path.add(pathagonBuilder.get().toSvgPath());
}
}
manually changed values.jpg (190.3 KB)
cone.7z (21.2 KB)