/** * This factory method returns a new offset for anchoring a rectangle its top-left corner. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 1.0) */ public static Offset topLeft() { return new Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 1.0); }
/** * This factory method returns a new offset used for anchoring a rectangle to its bottom-left corner. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 0.0) */ public static Offset bottomLeft() { return new Offset(WorldWind.OFFSET_FRACTION, 0.0, WorldWind.OFFSET_FRACTION, 0.0); }
/** * This factory method returns a new offset used for anchoring a rectangle to its center. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5) */ public static Offset center() { return new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.5); }
/** * This factory method returns a new offset for anchoring a rectangle to its top-right corner. * * @return Offset(WorldWind.OFFSET_FRACTION, 1.0, WorldWind.OFFSET_FRACTION, 1.0) */ public static Offset topRight() { return new Offset(WorldWind.OFFSET_FRACTION, 1.0, WorldWind.OFFSET_FRACTION, 1.0); }
/** * This factory method returns a new offset for anchoring a rectangle to its center of its bottom edge. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.0) */ public static Offset bottomCenter() { return new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 0.0); }
/** * This factory method returns a new offset for anchoring a rectangle to its bottom-right corner. * * @return Offset(WorldWind.OFFSET_FRACTION, 1.0, WorldWind.OFFSET_FRACTION, 0.0) */ public static Offset bottomRight() { return new Offset(WorldWind.OFFSET_FRACTION, 1.0, WorldWind.OFFSET_FRACTION, 0.0); }
/** * This factory method returns a new offset for anchoring a rectangle to the center of its top edge. * * @return Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 1.0) */ public static Offset topCenter() { return new Offset(WorldWind.OFFSET_FRACTION, 0.5, WorldWind.OFFSET_FRACTION, 1.0); }
public TextAttributes(TextAttributes attributes) { if (attributes == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "TextAttributes", "constructor", "missingAttributes")); } this.textColor = new Color(attributes.textColor); this.textOffset = new Offset(attributes.textOffset); this.textSize = attributes.textSize; this.typeface = attributes.typeface; this.outlineColor = new Color(attributes.outlineColor); this.enableOutline = attributes.enableOutline; this.enableDepthTest = attributes.enableDepthTest; this.outlineWidth = attributes.outlineWidth; }
/** * Constructs a placemark attribute bundle from the specified attributes. Performs a deep copy of the color, offset, * label attributes and leader-line attributes. * * @param attributes The attributes to be copied. * * @throws IllegalArgumentException If the location is null */ public PlacemarkAttributes(PlacemarkAttributes attributes) { if (attributes == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "PlacemarkAttributes", "constructor", "missingAttributes")); } this.imageSource = attributes.imageSource; this.imageColor = new Color(attributes.imageColor); this.imageOffset = new Offset(attributes.imageOffset); this.imageScale = attributes.imageScale; this.minimumImageScale = attributes.minimumImageScale; this.drawLeader = attributes.drawLeader; this.depthTest = attributes.depthTest; this.labelAttributes = attributes.labelAttributes != null ? new TextAttributes(attributes.labelAttributes) : null; this.leaderAttributes = attributes.leaderAttributes != null ? new ShapeAttributes(attributes.leaderAttributes) : null; }
this.placemarkOffset = new Offset(
@Test public void testGetTextOffset() throws Exception { TextAttributes attributes = new TextAttributes(); Offset lowerLeft = new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0); attributes.textOffset = lowerLeft; assertEquals(lowerLeft, attributes.getTextOffset()); }
@Test public void testSetTextOffset() throws Exception { TextAttributes attributes = new TextAttributes(); Offset lowerLeft = new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0); attributes.setTextOffset(lowerLeft); // Verify that the object is an equivalent deep copy. assertEquals(lowerLeft, attributes.textOffset); assertTrue(lowerLeft != attributes.textOffset); }
@Test public void testSet() throws Exception { TextAttributes attributes = new TextAttributes(); // create another attribute bundle with differing values TextAttributes other = new TextAttributes(); other.textColor = new Color(0, 0, 0, 0); other.textOffset = new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0); other.textSize = 0.0f; other.typeface = Typeface.defaultFromStyle(Typeface.NORMAL); other.enableOutline = false; other.enableDepthTest = false; other.outlineWidth = 0.0f; attributes.set(other); assertEquals(attributes, other); }
@Test public void testInequality() throws Exception { TextAttributes typical = new TextAttributes(); TextAttributes different = new TextAttributes(); different.textColor = new Color(0, 0, 0, 0); different.textOffset = new Offset(WorldWind.OFFSET_PIXELS, 0, WorldWind.OFFSET_PIXELS, 0); different.textSize = 0.0f; different.typeface = Typeface.defaultFromStyle(Typeface.NORMAL); different.enableOutline = false; different.enableDepthTest = false; different.outlineWidth = 0.0f; assertNotEquals(different.textColor, typical.textColor); assertNotEquals(different.textOffset, typical.textOffset); assertNotEquals(different.textSize, typical.textSize); assertNotEquals(different.typeface, typical.typeface); assertNotEquals(different.enableOutline, typical.enableOutline); assertNotEquals(different.enableDepthTest, typical.enableDepthTest); assertNotEquals(different.outlineWidth, typical.outlineWidth); assertNotEquals(different, typical); assertNotEquals(typical, different); assertNotEquals(typical, null); }