Package slash.navigation.kml.binding20

Examples of slash.navigation.kml.binding20.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


  }

  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

        }

        @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

    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

    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

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            Placemark pm = (Placemark) feature;
            // while it's possible to have more than one style object, GE will only paint
            // the first one
            Style style = pm.createAndAddStyle();
            List<Symbolizer> symbolizers = context.getCurrentSymbolizers();
            SimpleFeature sf = context.getCurrentFeature();
            if (symbolizers.size() > 0 && sf.getDefaultGeometry() != null) {
                // sort by point, text, line and polygon
                Map<Class, List<Symbolizer>> classified = classifySymbolizers(symbolizers);
View Full Code Here

    static class PlacemarkSelfLinkDecorator extends AbstractGeoSearchDecorator {
        static final Logger LOGGER = Logging.getLogger(PlacemarkSelfLinkDecorator.class);

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

            try {
                link = getFeatureTypeURL(context);
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }
            String[] id = context.getCurrentFeature().getID().split("\\.");

            link = link + "/" + id[1] + ".kml";

            Link al = pm.createAndSetAtomLink(link);
            al.setRel("self");
           
            return pm;
        }
View Full Code Here


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

            // create the extended data, and encode any non null, non geometric attribute
            ExtendedData exd = pm.createAndSetExtendedData();
            SchemaData schemaData = exd.createAndAddSchemaData();
            schemaData.setSchemaUrl("#" + context.getCurrentFeatureType().getTypeName() + "_" + context.getCurrentLayerIndex());
            for (AttributeDescriptor ad : sf.getFeatureType().getAttributeDescriptors()) {
                // skip geometry attributes
                if (ad instanceof GeometryDescriptor) {
View Full Code Here

    class PlacemarkLookAtDecorator implements KmlDecorator {

        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            Placemark pm = (Placemark) feature;
            Geometry geometry = (Geometry) context.getCurrentFeature().getDefaultGeometry();
            Envelope bounds = null;
            if (geometry != null) {
                bounds = geometry.getEnvelopeInternal();
            }
            LookAt lookAt = buildLookAt(bounds, context.getLookAtOptions(), true);
            pm.setAbstractView(lookAt);

            return pm;
        }
View Full Code Here

            } catch (IOException e) {
                String msg = "Error occured processing 'description' template.";
                LOGGER.log(Level.WARNING, msg, e);
            }

            Placemark pm = (Placemark) feature;
            if (description != null) {
                pm.setDescription(description);
            }
            return pm;
        }
View Full Code Here

TOP

Related Classes of slash.navigation.kml.binding20.Placemark

Copyright © 2018 www.massapicom. 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.