/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param rotation - the rotaion of the label * @return the pointplacement created */ public PointPlacement createPointPlacement(double anchorX, double anchorY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); return sf.createPointPlacement(anchorPoint, null, literalExpression(rotation)); }
/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param displacementX - the X distance from the anchor * @param displacementY - the Y distance from the anchor * @param rotation - the rotaion of the label * @return the pointplacement created */ public PointPlacement createPointPlacement( double anchorX, double anchorY, double displacementX, double displacementY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); Displacement displacement = createDisplacement(displacementX, displacementY); return sf.createPointPlacement(anchorPoint, displacement, literalExpression(rotation)); }
@Test public void testGraphicAnchor() { Graphic g = sb.createGraphic(); g.setAnchorPoint(sb.createAnchorPoint(ff.property("ax"), ff.property("ay"))); StyleAttributeExtractor extractor = new StyleAttributeExtractor(); g.accept(extractor); // check the plain names Set<String> atts = extractor.getAttributeNameSet(); assertEquals(2, atts.size()); assertTrue(atts.contains("ax")); assertTrue(atts.contains("ay")); }
/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param rotation - the rotaion of the label * * @return the pointplacement created */ public PointPlacement createPointPlacement(double anchorX, double anchorY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); return sf.createPointPlacement(anchorPoint, null, literalExpression(rotation)); }
public AnchorPoint getEdited(){ if(anchor == null){ StyleBuilder sb = new StyleBuilder(); anchor = sb.createAnchorPoint(0,0); } apply(); return anchor; }
/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param rotation - the rotaion of the label * * @return the pointplacement created */ public PointPlacement createPointPlacement(double anchorX, double anchorY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); return sf.createPointPlacement(anchorPoint, null, literalExpression(rotation)); }
/** * Given a string of "bottom-right" or "top-left" find the x,y coordinates and create an * AnchorPoint * * @param textAnchor The value of the "text-anchor" property in the mapbox style. * @return AnchorPoint */ AnchorPoint getAnchorPoint(String textAnchor) { TextAnchor anchor = TextAnchor.parse(textAnchor); return sb.createAnchorPoint(anchor.getX(), anchor.getY()); }
/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param displacementX - the X distance from the anchor * @param displacementY - the Y distance from the anchor * @param rotation - the rotaion of the label * * @return the pointplacement created */ public PointPlacement createPointPlacement( double anchorX, double anchorY, double displacementX, double displacementY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); Displacement displacement = createDisplacement(displacementX, displacementY); return sf.createPointPlacement(anchorPoint, displacement, literalExpression(rotation)); }
/** * wrapper round Stylefactory Method * * @param anchorX - the X coordinate * @param anchorY - the Y coordinate * @param displacementX - the X distance from the anchor * @param displacementY - the Y distance from the anchor * @param rotation - the rotaion of the label * * @return the pointplacement created */ public PointPlacement createPointPlacement( double anchorX, double anchorY, double displacementX, double displacementY, double rotation) { AnchorPoint anchorPoint = createAnchorPoint(anchorX, anchorY); Displacement displacement = createDisplacement(displacementX, displacementY); return sf.createPointPlacement(anchorPoint, displacement, literalExpression(rotation)); }
double expectedAnchorPointX = 0.25; double expectedAnchorPointY = 0.75; graphic.setAnchorPoint(sb.createAnchorPoint(expectedAnchorPointX, expectedAnchorPointY)); stroke.setGraphicStroke(graphic);