protected static PlacemarkAttributes createPlacemarkAttributes(Resources resources, @DrawableRes int resourceId, double scale) { PlacemarkAttributes placemarkAttributes = new PlacemarkAttributes(); // Create a BitmapFactory instance with the values needed to create and recreate the symbol's bitmap //IconBitmapFactory factory = new IconBitmapFactory(resources, resourceId); //placemarkAttributes.setImageSource(ImageSource.fromBitmapFactory(factory)).setImageScale(scale); placemarkAttributes.setImageSource(ImageSource.fromResource(resourceId)).setImageScale(scale).setMinimumImageScale(0.5); return placemarkAttributes; } }
/** * This factory method creates a Placemark and an associated PlacemarkAttributes bundle that draws the given image * centered on the supplied position. * * @param position The geographic position with the placemark is drawn. * @param imageSource The object containing the image that is drawn. * * @return A new Placemark with a PlacemarkAttributes bundle. */ public static Placemark createWithImage(Position position, ImageSource imageSource) { return new Placemark(position, PlacemarkAttributes.createWithImage(imageSource)); }
/** * Helper method to create aircraft placemarks. */ private static Placemark createAircraftPlacemark(Position position) { Placemark placemark = Placemark.createWithImage(position, ImageSource.fromResource(R.drawable.aircraft_fighter)); placemark.getAttributes().setImageOffset(Offset.bottomCenter()).setImageScale(NORMAL_IMAGE_SCALE).setDrawLeader(true); placemark.setHighlightAttributes(new PlacemarkAttributes(placemark.getAttributes()).setImageScale(HIGHLIGHTED_IMAGE_SCALE)); return placemark; }
public static PlacemarkAttributes createWithImageAndLeader(ImageSource imageSource) { return new PlacemarkAttributes().setImageSource(imageSource).setDrawLeader(true); }
public static PlacemarkAttributes createWithImage(ImageSource imageSource) { return new PlacemarkAttributes().setImageSource(imageSource); }
/** * Helper method to create aircraft placemarks. The aircraft are selectable, movable, and editable. */ protected static Placemark createAircraftPlacemark(Position position, String aircraftName, String aircraftType) { if (!aircraftIconMap.containsKey(aircraftType)) { throw new IllegalArgumentException(aircraftType + " is not valid."); } Placemark placemark = Placemark.createWithImage(position, ImageSource.fromResource(aircraftIconMap.get(aircraftType))); placemark.getAttributes().setImageOffset(Offset.bottomCenter()).setImageScale(NORMAL_IMAGE_SCALE).setDrawLeader(true); placemark.getAttributes().getLeaderAttributes().setOutlineWidth(4); placemark.setHighlightAttributes(new PlacemarkAttributes(placemark.getAttributes()).setImageScale(HIGHLIGHTED_IMAGE_SCALE).setImageColor(new Color(android.graphics.Color.YELLOW))); placemark.setDisplayName(aircraftName); // The AIRCRAFT_TYPE property is used to exchange the vehicle type with the VehicleTypeDialog placemark.putUserProperty(AIRCRAFT_TYPE, aircraftType); // The select/drag controller will examine a placemark's "capabilities" to determine what operations are applicable: placemark.putUserProperty(SELECTABLE, null); placemark.putUserProperty(EDITABLE, null); placemark.putUserProperty(MOVABLE, null); return placemark; }
protected void createPlacemark(Position position, RenderableLayer layer) { Placemark placemark = new Placemark(position); placemark.getAttributes().setImageSource(ImageSource.fromResource(R.drawable.aircraft_fixwing)); placemark.getAttributes().setImageScale(2); placemark.getAttributes().setDrawLeader(true); layer.addRenderable(placemark); }
/** * Helper method to create vehicle placemarks. */ protected static Placemark createAutomobilePlacemark(Position position, String name, String automotiveType) { if (!automotiveIconMap.containsKey(automotiveType)) { throw new IllegalArgumentException(automotiveType + " is not valid."); } Placemark placemark = Placemark.createWithImage(position, ImageSource.fromResource(automotiveIconMap.get(automotiveType))); placemark.getAttributes().setImageOffset(Offset.bottomCenter()).setImageScale(NORMAL_IMAGE_SCALE); placemark.setHighlightAttributes(new PlacemarkAttributes(placemark.getAttributes()).setImageScale(HIGHLIGHTED_IMAGE_SCALE).setImageColor(new Color(android.graphics.Color.YELLOW))); placemark.setDisplayName(name); // The AUTOMOTIVE_TYPE property is used to exchange the vehicle type with the VehicleTypeDialog placemark.putUserProperty(AUTOMOTIVE_TYPE, automotiveType); // The select/drag controller will examine a placemark's "capabilities" to determine what operations are applicable: placemark.putUserProperty(SELECTABLE, null); placemark.putUserProperty(EDITABLE, null); placemark.putUserProperty(MOVABLE, null); return placemark; }
/** * This factory method creates a Placemark and an associated PlacemarkAttributes bundle that draws a simple square * centered on the supplied position with the given size and color. * * @param position The geographic position where the placemark is drawn. * @param color The color of the placemark. * @param pixelSize The width and height of the placemark. * * @return A new Placemark with a PlacemarkAttributes bundle. */ public static Placemark createWithColorAndSize(Position position, Color color, int pixelSize) { return new Placemark(position, new PlacemarkAttributes().setImageColor(color).setImageScale(pixelSize)); }
PlacemarkAttributes.createWithImageAndLeader(ImageSource.fromResource(R.drawable.aircraft_fixwing)).setImageScale(1.5)); PlacemarkAttributes.createWithImage(ImageSource.fromResource(R.drawable.airport_terminal)).setImageOffset(Offset.bottomCenter()).setImageScale(2), "Oxnard Airport"); Placemark wildfire = new Placemark( Position.fromDegrees(34.300, -119.25, 0), PlacemarkAttributes.createWithImage(ImageSource.fromBitmap(bitmap)).setImageOffset(Offset.bottomCenter()));
double scale = this.placemarkAttributes.getImageScale(); this.placemarkAttributes = new PlacemarkAttributes(this.placemarkAttributes).setImageScale(scale * 1.2);
PlacemarkAttributes.createWithImageAndLeader(ImageSource.fromResource(R.drawable.airport)), "Origin"); Placemark northPole = new Placemark(Position.fromDegrees(90, 0, 1e5), PlacemarkAttributes.createWithImageAndLeader(ImageSource.fromResource(R.drawable.airport_terminal)), "North Pole"); Placemark southPole = new Placemark(Position.fromDegrees(-90, 0, 0), PlacemarkAttributes.createWithImage(ImageSource.fromResource(R.drawable.airplane)), "South Pole"); Placemark antiMeridian = new Placemark(Position.fromDegrees(0, 180, 0), PlacemarkAttributes.createWithImage(ImageSource.fromResource(R.drawable.ic_menu_home)), "Anti-meridian"); PlacemarkAttributes attributes = PlacemarkAttributes.createWithImage(ImageSource.fromResource(R.drawable.aircraft_fixwing)); new PlacemarkAttributes(attributes).setMinimumImageScale(0.5)).setEyeDistanceScaling(true); placemark.setDisplayName(placemark.getPosition().toString());
/** * Helper method to create airport placemarks. */ private static Placemark createAirportPlacemark(Position position, String airportName) { Placemark placemark = Placemark.createWithImage(position, ImageSource.fromResource(R.drawable.airport_terminal)); placemark.getAttributes().setImageOffset(Offset.bottomCenter()).setImageScale(NORMAL_IMAGE_SCALE); placemark.setHighlightAttributes(new PlacemarkAttributes(placemark.getAttributes()).setImageScale(HIGHLIGHTED_IMAGE_SCALE)); placemark.setDisplayName(airportName); return placemark; }
/** * Helper method to create airport placemarks. */ protected static Placemark createAirportPlacemark(Position position, String airportName) { Placemark placemark = Placemark.createWithImage(position, ImageSource.fromResource(R.drawable.airport_terminal)); placemark.getAttributes().setImageOffset(Offset.bottomCenter()).setImageScale(NORMAL_IMAGE_SCALE); placemark.setDisplayName(airportName); return placemark; }
/** * Constructs a Placemark that draws its representation at the supplied position using default {@link * PlacemarkAttributes} bundle. The displayName and label properties are empty. * * @param position The placemark's geographic position */ public Placemark(Position position) { this(position, new PlacemarkAttributes()); }
public void onFinished(String vehicleType) { PlacemarksSelectDragActivity activity = (PlacemarksSelectDragActivity) getActivity(); if (activity.controller.selectedObject instanceof Placemark) { Placemark placemark = (Placemark) activity.controller.selectedObject; String currentType = (String) placemark.getUserProperty(this.vehicleKey); if (currentType.equals(vehicleType)) { return; } // Update the placemark's icon attributes and vehicle type property. ImageSource imageSource = ImageSource.fromResource(this.vehicleIcons.get(vehicleType)); placemark.putUserProperty(this.vehicleKey, vehicleType); placemark.getAttributes().setImageSource(imageSource); placemark.getHighlightAttributes().setImageSource(imageSource); // Show the change activity.getWorldWindow().requestRedraw(); } }
@Override public void run() { placemarkAttributes.setImageOffset(placemarkOffset); } });
this.sightlinePlacemark = new Placemark(pos); this.sightlinePlacemark.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); this.sightlinePlacemark.getAttributes().setImageSource(ImageSource.fromResource(R.drawable.aircraft_fixwing)); this.sightlinePlacemark.getAttributes().setImageScale(2); this.sightlinePlacemark.getAttributes().setDrawLeader(true);
double scale = this.attributes.getImageScale(); this.attributes = new PlacemarkAttributes(this.attributes).setImageScale(scale * 2.0);
/** * Creates a placemark attributes bundle containing a MIL-STD-2525 symbol using the specified modifiers and * attributes. The ImageSource bitmap is lazily created via an ImageSource.Bitmap factory. The call to the * factory's createBitmap method made when Placemark comes into view; it's also used to recreate the bitmap if the * resource was evicted from the WorldWind render resource cache. * * @param symbolCode The 15-character SIDC (symbol identification coding scheme) code. * @param modifiers The ModifierUnit (unit) or ModifierTG (tactical graphic) modifiers collection. May be null. * @param attributes The MilStdAttributes attributes collection. May be null. * * @return A new PlacemarkAttributes bundle representing the MIL-STD-2525 symbol. */ public static PlacemarkAttributes createPlacemarkAttributes(String symbolCode, SparseArray<String> modifiers, SparseArray<String> attributes) { PlacemarkAttributes placemarkAttributes = new PlacemarkAttributes(); // Create a BitmapFactory instance with the values needed to create and recreate the symbol's bitmap SymbolBitmapFactory factory = new SymbolBitmapFactory(symbolCode, modifiers, attributes, placemarkAttributes); placemarkAttributes.setImageSource(ImageSource.fromBitmapFactory(factory)); return placemarkAttributes; }