public float[] getParams() { return getParams(null); }
public float[] getParams() { return getParams(null); }
private PMatrix getMatrix(PShape shape) { boolean useParams = true; float[] params = null; try { params = shape.getParams(); } catch (NullPointerException npe) { useParams = false; } PMatrix matrix = ((PShapeSVGExtended) shape).getMatrix(); if (matrix == null) { matrix = new PMatrix2D(); } else { // use a copy matrix = matrix.get(); } if (useParams) { matrix.translate(params[0], params[1]); } // is root. if (shape.getParent() == null) { return matrix; } PMatrix2D parentMat = (PMatrix2D) getMatrix(shape.getParent()); matrix.preApply(parentMat); return matrix; }
private MarkerSvg createMarker(PShape markerSvg, int id) { float[] params = markerSvg.getParams();
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics3D.createShapeImpl(pg, GROUP); dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); copyGroup(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams()); dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY); dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); //dest = PGraphics3D.createShapeImpl(pg, PATH); PShape.copyPath(src, dest); } dest.setName(src.getName()); dest.width = src.width; dest.height = src.height; dest.depth = src.depth; return dest; }
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) { PShapeOpenGL dest = null; if (src.getFamily() == GROUP) { //dest = PGraphics3D.createShapeImpl(pg, GROUP); dest = (PShapeOpenGL) pg.createShapeFamily(GROUP); copyGroup(pg, src, dest); } else if (src.getFamily() == PRIMITIVE) { //dest = PGraphics3D.createShapeImpl(pg, src.getKind(), src.getParams()); dest = (PShapeOpenGL) pg.createShapePrimitive(src.getKind(), src.getParams()); PShape.copyPrimitive(src, dest); } else if (src.getFamily() == GEOMETRY) { //dest = PGraphics3D.createShapeImpl(pg, PShape.GEOMETRY); dest = (PShapeOpenGL) pg.createShapeFamily(PShape.GEOMETRY); PShape.copyGeometry(src, dest); } else if (src.getFamily() == PATH) { dest = (PShapeOpenGL) pg.createShapeFamily(PShape.PATH); //dest = PGraphics3D.createShapeImpl(pg, PATH); PShape.copyPath(src, dest); } dest.setName(src.getName()); dest.width = src.width; dest.height = src.height; dest.depth = src.depth; return dest; }