use of de.micromata.opengis.kml.v_2_2_0.Location in project googleads-java-lib by googleads.
the class CreateTrafficForecastSegments method runExample.
/**
* Runs the example.
*
* @param adManagerServices the services factory.
* @param session the session.
* @throws ApiException if the API request failed with one or more service errors.
* @throws RemoteException if the API request failed due to other errors.
*/
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
// Get the adjustment service and the network service.
AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class);
NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class);
// Get the root ad unit ID used to target the whole site.
String rootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();
// Create inventory targeting.
InventoryTargeting inventoryTargeting = new InventoryTargeting();
// Create ad unit targeting for the root ad unit (i.e. the whole network).
AdUnitTargeting adUnitTargeting = new AdUnitTargeting();
adUnitTargeting.setAdUnitId(rootAdUnitId);
adUnitTargeting.setIncludeDescendants(true);
inventoryTargeting.setTargetedAdUnits(new AdUnitTargeting[] { adUnitTargeting });
// Create targeting for United States traffic.
GeoTargeting geoTargeting = new GeoTargeting();
Location countryLocation = new Location();
countryLocation.setId(2840L);
geoTargeting.setTargetedLocations(new Location[] { countryLocation });
Targeting targeting = new Targeting();
targeting.setInventoryTargeting(inventoryTargeting);
targeting.setGeoTargeting(geoTargeting);
TrafficForecastSegment segment = new TrafficForecastSegment();
segment.setTargeting(targeting);
segment.setName("Forecast segment #" + new Random().nextInt(Integer.MAX_VALUE));
// Create the traffic forecst segment on the server.
TrafficForecastSegment[] segments = adjustmentService.createTrafficForecastSegments(new TrafficForecastSegment[] { segment });
for (TrafficForecastSegment createdSegment : segments) {
System.out.printf("Traffic forecast segment with ID %d and %d forecast adjustments was created.%n", createdSegment.getId(), createdSegment.getActiveForecastAdjustmentCount());
}
}
use of de.micromata.opengis.kml.v_2_2_0.Location in project java-client by appium.
the class AndroidDriverTest method geolocationTest.
@Test
public void geolocationTest() {
Location location = new Location(45, 45, 100);
driver.setLocation(location);
}
use of de.micromata.opengis.kml.v_2_2_0.Location in project libSBOLj by SynBioDex.
the class SequenceAnnotationTest method test_locationMethods.
@Test
public void test_locationMethods() throws SBOLValidationException {
Cut promoter_cut = promoter_SA.addCut("promoter_cut", 1);
assertTrue(gRNA_b_gene.getSequenceAnnotation("promoter_SA").getLocation("promoter_cut").equals(promoter_cut));
promoter_cut.unsetOrientation();
assertNull(promoter_cut.getOrientation());
Location test = promoter_cut;
assertNotNull(test.toString());
Cut terminator_cut = terminator_SA.addCut("terminator_cut", 100);
assertTrue(gRNA_b_gene.getSequenceAnnotation("terminator_SA").getLocation("terminator_cut").equals(terminator_cut));
Cut gene_cut = gene_SA.addCut("gene_cut", 50, OrientationType.INLINE);
assertTrue(gRNA_b_gene.getSequenceAnnotation("gene_SA").getLocation("gene_cut").equals(gene_cut));
gene_SA.removeLocation(gene_cut);
assertNull(gene_SA.getLocation("gene_cut"));
Range gene_range = gene_SA.addRange("gene_range", 50, 99);
assertTrue(gRNA_b_gene.getSequenceAnnotation("gene_SA").getLocation("gene_range").equals(gene_range));
gene_range.unsetOrientation();
assertNull(gene_range.getOrientation());
promoter_SA.removeLocation(promoter_cut);
assertNull(promoter_SA.getLocation(promoter_cut.getIdentity()));
GenericLocation promoter_glocation = promoter_SA.addGenericLocation("promoter_glocation");
assertTrue(gRNA_b_gene.getSequenceAnnotation("promoter_SA").getLocation("promoter_glocation").equals(promoter_glocation));
terminator_SA.removeLocation(terminator_cut);
assertNull(terminator_SA.getLocation("terminator_cut"));
GenericLocation terminator_glocation = terminator_SA.addGenericLocation("terminator_glocation", OrientationType.INLINE);
assertTrue(gRNA_b_gene.getSequenceAnnotation("terminator_SA").getLocation("terminator_glocation").equals(terminator_glocation));
}
use of de.micromata.opengis.kml.v_2_2_0.Location in project libSBOLj by SynBioDex.
the class SequenceAnnotationTest method test_LocToString.
/*
*
* move to Location Test class
*/
@Test
public void test_LocToString() throws SBOLValidationException {
Location test = promoter_SA.addGenericLocation("promoter_cut");
assertTrue(test.toString().length() != 0);
assertNotNull(test.toString());
assertTrue(test.toString().contains("identity="));
assertTrue(test.toString().contains("displayId="));
assertTrue(!test.toString().contains("description="));
assertTrue(!test.toString().contains("orientation="));
assertTrue(!test.toString().contains("name="));
}
use of de.micromata.opengis.kml.v_2_2_0.Location in project ddf by codice.
the class KmlModelToJtsPointConverter method from.
public static Point from(Model kmlModel) {
if (kmlModel == null || kmlModel.getLocation() == null) {
return null;
}
Location kmlLocation = kmlModel.getLocation();
Coordinate jtsCoordinate = new Coordinate(kmlLocation.getLongitude(), kmlLocation.getLatitude(), kmlLocation.getAltitude());
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
return geometryFactory.createPoint(jtsCoordinate);
}
Aggregations