We currently don't have a composite symbol in the API. If I can gather requirements then this can be considered for a future release.
The sample application shows you how you can create a composite symbol made up from a few different things.
Does this answer your question?
/** * Sets the direction of travel property on this symbol * * @param angle The direction of travel to set. * @param angularUnit The units for the direction of travel. */ public void setDirectionOfTravel(double angle, AngularUnit angularUnit) { this.symbols.remove(this.directionOfTravel); this.symbols.remove(this.directionOfTravelGroundLine); double radians = swapCompassHeadingAndTrigAngle(Code.RADIAN == angularUnit.getID() ? angle : angularUnit.convertToRadians(angle)); boolean isGround = 'G' == this.sic.charAt(2) || 'g' == this.sic.charAt(2); if (isGround) { //Battle dimension is Ground; draw line straight down behind frame BufferedImage groundImage = new BufferedImage(DIRECTION_LINE_THICKNESS, DIRECTION_OF_MOVEMENT_LENGTH, BufferedImage.TYPE_INT_RGB); Graphics2D g = groundImage.createGraphics(); g.setBackground(Color.BLACK); this.directionOfTravelGroundLine = new PictureMarkerSymbol(groundImage); this.directionOfTravelGroundLine.setOffsetY(DIRECTION_OF_MOVEMENT_LENGTH / -2); this.symbols.add(0, this.directionOfTravelGroundLine); this.updateSymbol(); } //Draw arrow directly from center and on top of frame double x = DIRECTION_OF_MOVEMENT_LENGTH * Math.cos(radians); double y = DIRECTION_OF_MOVEMENT_LENGTH * Math.sin(radians); BufferedImage directionImage = new BufferedImage(2 * DIRECTION_OF_MOVEMENT_LENGTH, 2 * DIRECTION_OF_MOVEMENT_LENGTH, BufferedImage.TYPE_INT_ARGB); Graphics2D g = directionImage.createGraphics(); g.setColor(Color.BLACK); g.setStroke(new BasicStroke(DIRECTION_LINE_THICKNESS)); g.drawLine(DIRECTION_OF_MOVEMENT_LENGTH, DIRECTION_OF_MOVEMENT_LENGTH, DIRECTION_OF_MOVEMENT_LENGTH + (int) Math.round(x), DIRECTION_OF_MOVEMENT_LENGTH - (int) Math.round(y)); double firstArrowAngle = radians + Math.PI + DIRECTION_ARROWHEAD_ANGLE; double firstArrowX = DIRECTION_ARROWHEAD_HEIGHT * Math.cos(firstArrowAngle); double firstArrowY = DIRECTION_ARROWHEAD_HEIGHT * Math.sin(firstArrowAngle); double secondArrowAngle = radians + Math.PI - DIRECTION_ARROWHEAD_ANGLE; double secondArrowX = DIRECTION_ARROWHEAD_HEIGHT * Math.cos(secondArrowAngle); double secondArrowY = DIRECTION_ARROWHEAD_HEIGHT * Math.sin(secondArrowAngle); g.fillPolygon(new int[] { DIRECTION_OF_MOVEMENT_LENGTH + (int) Math.round(x), DIRECTION_OF_MOVEMENT_LENGTH + (int) Math.round(x) + (int) Math.round(firstArrowX), DIRECTION_OF_MOVEMENT_LENGTH + (int) Math.round(x) + (int) Math.round(secondArrowX)}, new int[] { DIRECTION_OF_MOVEMENT_LENGTH - (int) Math.round(y), DIRECTION_OF_MOVEMENT_LENGTH - (int) Math.round(y) - (int) Math.round(firstArrowY), DIRECTION_OF_MOVEMENT_LENGTH - (int) Math.round(y) - (int) Math.round(secondArrowY)}, 3); this.directionOfTravel = new PictureMarkerSymbol(directionImage); if (isGround) { this.directionOfTravel.setOffsetY(-1 * DIRECTION_OF_MOVEMENT_LENGTH); } this.symbols.add(this.directionOfTravel); this.updateSymbol(); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.