Examples of Placemark


Examples of com.googlecode.libkml.Placemark

    KmlFactory factory = KmlFactory.GetFactory();

    Folder folder = factory.CreateFolder();
    folder.set_name("foo");

    Placemark p0 = factory.CreatePlacemark();
    p0.set_name("placemark 0");
    p0.set_id("p0");

    folder.add_feature(p0);

    System.out.println("folder size: " + folder.get_feature_array_size());

    System.out.println("name: " + folder.get_name());

    Feature f = folder.get_feature_array_at(0);

    Placemark p = kmldom.AsPlacemark(f);

    System.out.println("placemark name: " + p.get_name());

    System.out.print(kmldom.SerializePretty(p));
  }
View Full Code Here

Examples of com.googlecode.mashups.services.generic.api.PlaceMark

public class LocationServiceTest extends TestCase {
    public void testGetAddressFromLocation() throws Exception {
        LocationService locationService = GenericServicesFactory.getLocationService();
       
        try {
            PlaceMark placeMark = locationService.getAddressFromLocation("37.4216410", "-122.08550160");
           
            System.out.println("Address for (\"37.4216410\", \"-122.08550160\") is: " + placeMark.getAddress() +
                           ", postalCode is: " + placeMark.getPostalCodeNumber());
           
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unable to get the address from the location ...");
        }       
View Full Code Here

Examples of com.googlecode.mashups.services.generic.api.PlaceMark

                                     + latitude.trim()
                                     + ","
                                     + longitude.trim()
                                     + "&sensor=false");
           
            PlaceMark      placeMark = new PlaceMark();
            JSONObject     json      = new JSONObject(readURL(url));
            JSONArray      results   = (JSONArray) json.getJSONArray(Mashups4JSFConstants.RESULTS_LABEL);
           
            JSONObject placeMarkPrimaryData = (JSONObject) results.get(0);
           
View Full Code Here

Examples of com.googlecode.mashups.services.generic.api.PlaceMark

    public void processValueChangeForMarker(ValueChangeEvent valueChangeEvent) {
      Position value = (Position) valueChangeEvent.getNewValue();
       
        if (value != null) {
            try {
                PlaceMark placeMark = GenericServicesFactory.getLocationService().getAddressFromLocation (value.getLatitude(), value.getLongitude());
               
                address    = placeMark.getAddress();
                postalCode = placeMark.getPostalCodeNumber();
                location   = value.getLatitude() + ", " + value.getLongitude();
               
                System.out.println("LatLng: " + value.getLatitude() + ", " + value.getLongitude());
                System.out.println("address: " + address);
                System.out.println("postalCode: " + postalCode);
View Full Code Here

Examples of com.motomapia.Placemark

    this.syncPlaces(wikis);

    List<Placemark> marks = new ArrayList<Placemark>(wikis.size());

    for (WikiPlace wiki: wikis)
      marks.add(new Placemark(wiki.getId(), wiki.getName(), wiki.getCenter(), wiki.getPolyline(), wiki.getPolygon().length, wiki.getArea()));

    return marks;
  }
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.Placemark

    }
    int n=0;
    for (Polygon polygon: polygons) {
      FeatureTable featureTable = polygonTable.get(n);
     
      Placemark placemark = folder.createAndAddPlacemark()
      .withDescription(featureTable.getHTMLDescription())
      .withVisibility(true);
     
      final de.micromata.opengis.kml.v_2_2_0.Polygon kmlPolygon = new de.micromata.opengis.kml.v_2_2_0.Polygon();
      placemark.setGeometry(kmlPolygon);

      kmlPolygon.setExtrude(true);
      kmlPolygon.setAltitudeMode(AltitudeMode.CLAMP_TO_GROUND);

      final Boundary outerboundary = new Boundary();
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.Placemark

  }

  private void addPoint(Feature feature, Point point, List<KmlModel> kmlModels) {
    Model kmlModel = getKmlModel(feature, point, kmlModels);
    if (kmlModel != null) {
      Placemark placemark = new Placemark().withName(feature.getName()
          .toString());
      placemark.createAndSetLookAt()
          .withLongitude(point.getCoordinate().x)
          .withLatitude(point.getCoordinate().y).withRange(440.8)
          .withTilt(8.3).withHeading(2.7);
      placemark.withGeometry(kmlModel);
      document.addToFeature(placemark);
    }
  }
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.Placemark

        }

        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            // encode the geometry
            Placemark pm = (Placemark) feature;
            SimpleFeature sf = context.getCurrentFeature();
           
            double height = Double.NaN;
            if(hasHeightTemplate) {
                try {
                    String output =  context.getTemplate().template(sf, "height.ftl", FeatureTemplate.class);
                    height = Double.valueOf(output);
                } catch (IOException ioe) {
                    LOGGER.log(Level.WARNING, "Couldn't render height template for " + sf.getID(), ioe);
                }
            }
           
            Geometry geometry = getFeatureGeometry(sf, height);
            if (geometry != null) {
                pm.setGeometry(encodeGeometry(geometry, context, height));
            }

            return feature;
        }
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.Placemark

    class PlacemarkTimeDecorator implements KmlDecorator {

        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            Placemark pm = (Placemark) feature;

            // try with the template
            SimpleFeature sf = context.getCurrentFeature();
            try {
                String[] times = execute(context.getTemplate(), sf);
                if (times != null && times.length > 0) {
                    if (times.length == 1) {
                        TimeStamp stamp = pm.createAndSetTimeStamp();
                        stamp.setWhen(times[0]);
                    } else {
                        TimeSpan span = pm.createAndSetTimeSpan();
                        span.setBegin(times[0]);
                        span.setEnd(times[1]);
                    }
                }
            } catch (IOException e) {
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.Placemark

    static class PlacemarkNameDecorator implements KmlDecorator {
        static final Logger LOGGER = Logging.getLogger(PlacemarkNameDecorator.class);
       
        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            Placemark pm = (Placemark) feature;

            // try with the template
            SimpleFeature sf = context.getCurrentFeature();
            String title = null;
            try {
                title = context.getTemplate().title(sf);
            } catch(IOException e) {
                String msg = "Error occured processing 'title' template.";
                LOGGER.log(Level.WARNING, msg, e);
            }

            // if we got nothing, set the title to the ID, but also try the text symbolizers
            String featureId = sf.getID();
            if (title == null || "".equals(title) || featureId.equals(title)) {
                title = featureId;

                // see if we can do better with a text symbolizer
                // symbolizers are available only in wms mode
                if(context.getCurrentSymbolizers() != null) {
                    StringBuffer label = new StringBuffer();
                    for (Symbolizer sym : context.getCurrentSymbolizers()) {
                        if (sym instanceof TextSymbolizer) {
                            Expression e = SLD.textLabel((TextSymbolizer) sym);
                            String value = e.evaluate(sf, String.class);
   
                            if ((value != null) && !"".equals(value.trim())) {
                                label.append(value);
                            }
                        }
                    }
   
                    if (label.length() > 0) {
                        title = label.toString();
                    }
                }
            }

            pm.setName(title);
            return pm;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.