Search in sources :

Example 1 with Geometry

use of ol.geom.Geometry in project gwt-ol3 by TDesjardins.

the class Measure method fireMeasureEvent.

/**
 * Fires a measure event.
 */
private void fireMeasureEvent() {
    // check if measuring is active and properly set up
    if (isActive && (sketch != null) && (listener != null)) {
        // get geometry in map projection
        Geometry geom = sketch.getGeometry();
        if (geom != null) {
            // transform it to lat/lon and fire event
            Geometry geomLatLon = geom.clone().transform(proj, PROJECTION_LATLON);
            listener.onMeasure(new MeasureEvent(geomLatLon));
        }
    }
}
Also used : Geometry(ol.geom.Geometry) MeasureEvent(ol.event.MeasureEvent)

Example 2 with Geometry

use of ol.geom.Geometry in project gwt-ol3 by TDesjardins.

the class WktTest method testWktToGeometry.

public void testWktToGeometry() {
    injectUrlAndTest(() -> {
        String wkt = wktFormat.writeGeometry(createTestFeature().getGeometry());
        assertNotNull(wkt);
        Geometry geometry = wktFormat.readGeometry(wkt, null);
        assertNotNull(geometry);
    });
}
Also used : Geometry(ol.geom.Geometry) LineString(ol.geom.LineString)

Aggregations

Geometry (ol.geom.Geometry)2 MeasureEvent (ol.event.MeasureEvent)1 LineString (ol.geom.LineString)1