/** * Called by doInBackground(); creates place icons from places collection and adds them to the places layer. */ private void createPlaceIcons() { publishProgress("Creating place icons..."); for (Place place : this.places) { // Create and configure a Placemark for this place, using a PlaceLevelOfDetailSelector to // dynamically set the PlacemarkAttributes. Placemark placemark = new Placemark(place.position, null, place.name); placemark.setLevelOfDetailSelector(new PlaceLevelOfDetailSelector(getResources(), place)); placemark.setEyeDistanceScaling(true); placemark.setEyeDistanceScalingThreshold(PlaceLevelOfDetailSelector.LEVEL_1_DISTANCE); // On a background thread, we can add Placemarks to a RenderableLayer that is // NOT attached to the WorldWindow. If the layer was attached to the WorldWindow // then we'd have to do this on the UI thread. Later, we'll add the layer to // WorldWindow on the UI thread in the onPostExecute() method. this.placeLayer.addRenderable(placemark); this.numPlacesCreated++; } } }
/** * A position associated with the object that indicates its aggregate geographic position. For a Placemark, this is * simply it's position property. * * @return {@link Placemark#getPosition()} */ @Override public Position getReferencePosition() { return getPosition(); }
/** * 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; }
/** * Constructs a Placemark with a label that draws its representation at the supplied position using the given {@link * PlacemarkAttributes} bundle. The displayName is set to the supplied name string. * * @param position The placemark's geographic position * @param attributes The attributes to associate with this placemark. May be null, but if null the placemark will * not be drawn. * @param name The text for the {@link Placemark#displayName}. */ public Placemark(Position position, PlacemarkAttributes attributes, String name) { this.setPosition(position); this.setAltitudeMode(WorldWind.ABSOLUTE); this.setDisplayName(name == null || name.isEmpty() ? "Placemark" : name); // this.setLabel(name); // TODO: call setLabel(name) this.attributes = attributes; this.eyeDistanceScaling = false; this.eyeDistanceScalingThreshold = DEFAULT_EYE_DISTANCE_SCALING_THRESHOLD; this.eyeDistanceScalingLabelThreshold = 1.5 * this.eyeDistanceScalingThreshold; this.imageRotationReference = WorldWind.RELATIVE_TO_SCREEN; this.imageTiltReference = WorldWind.RELATIVE_TO_SCREEN; }
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); }
Placemark origin = new Placemark(Position.fromDegrees(0, 0, 1e5), 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"); Position pos = Position.fromDegrees(lat, lon, 0); Placemark placemark = new Placemark(pos, new PlacemarkAttributes(attributes).setMinimumImageScale(0.5)).setEyeDistanceScaling(true); placemark.setDisplayName(placemark.getPosition().toString());
/** * 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; }
this.sightline.setOccludeAttributes(blockedRegions); this.sightline.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); 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);
Placemark ventura = Placemark.createWithColorAndSize(Position.fromDegrees(34.281, -119.293, 0), new Color(0, 1, 1, 1), 20); Placemark airplane = new Placemark( Position.fromDegrees(34.260, -119.2, 5000), PlacemarkAttributes.createWithImageAndLeader(ImageSource.fromResource(R.drawable.aircraft_fixwing)).setImageScale(1.5)); Placemark airport = new Placemark( Position.fromDegrees(34.200, -119.208, 0), PlacemarkAttributes.createWithImage(ImageSource.fromResource(R.drawable.airport_terminal)).setImageOffset(Offset.bottomCenter()).setImageScale(2), Placemark wildfire = new Placemark( Position.fromDegrees(34.300, -119.25, 0), PlacemarkAttributes.createWithImage(ImageSource.fromBitmap(bitmap)).setImageOffset(Offset.bottomCenter())); Position pos = airport.getPosition(); LookAt lookAt = new LookAt().set(pos.latitude, pos.longitude, pos.altitude, WorldWind.ABSOLUTE, 1e5 /*range*/, 0 /*heading*/, 80 /*tilt*/, 0 /*roll*/);
/** * 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 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(); } }
/** * 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)); }
/** * Moves the shape over the globe's surface. For a Placemark, this simply calls {@link * Placemark#setPosition(Position)}. * * @param globe not used. * @param position the new position of the shape's reference position. */ @Override public void moveTo(Globe globe, Position position) { setPosition(position); }
if (fields[NA3].startsWith("US") && fields[USE].equals("49")) { // display USA Civilian/Public airports Position pos = Position.fromDegrees(Double.parseDouble(fields[LAT]), Double.parseDouble(fields[LON]), 0); layer.addRenderable(new Placemark(pos, attrs[attrIndex++ % attrs.length]));
/** * Updates the aircraft placemark positions on the UI Thread. */ @Override protected void onPostExecute(Void notUsed) { super.onPostExecute(notUsed); // Update the aircraft placemark positions with the positions computed on the background thread. for (Placemark aircraft : aircraftPositions.keySet()) { aircraft.setPosition(aircraftPositions.get(aircraft)); } getWorldWindow().requestRedraw(); // Determine if the animation is done if (frameCount > ANIMATION_FRAMES) { // All the aircraft have arrived at their destinations; pause the animation pauseAnimation = true; statusText.setText("Animation complete"); } // Re-execute the animation after the prescribed delay if (!pauseAnimation) { handler.postDelayed(PlacemarksMilStd2525DemoActivity.this, DELAY_TIME); } } }
/** * 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; }
Placemark drone = new Placemark( Position.fromDegrees(32.4520, 63.44553, 3000), MilStd2525.getPlacemarkAttributes("SFAPMFQM--GIUSA", modifiers, null)); modifiers.put(ModifiersUnits.Q_DIRECTION_OF_MOVEMENT, "90"); modifiers.put(ModifiersUnits.AJ_SPEED_LEADER, "0.1"); Placemark launcher = new Placemark( Position.fromDegrees(32.4014, 63.3894, 0), MilStd2525.getPlacemarkAttributes("SHGXUCFRMS----G", modifiers, null)); modifiers.put(ModifiersUnits.V_EQUIP_TYPE, "MACHINE GUN"); modifiers.put(ModifiersUnits.W_DTG_1, "30140000ZSEP97"); // Date/Time Group Placemark machineGun = new Placemark( Position.fromDegrees(32.3902, 63.4161, 0), MilStd2525.getPlacemarkAttributes("SFGPEWRH--MTUSG", modifiers, null));
Position position = ((Placemark) this.selectedObject).getPosition(); double altitude = position.altitude; if (getWorldWindow().geographicToScreenPoint(position.latitude, position.longitude, 0 /*altitude*/, this.dragRefPt)) {
/** * 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; }
/** * 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)); }