Search in sources :

Example 16 with Location

use of com.google.api.ads.admanager.axis.v202202.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());
    }
}
Also used : NetworkServiceInterface(com.google.api.ads.admanager.axis.v202202.NetworkServiceInterface) TrafficForecastSegment(com.google.api.ads.admanager.axis.v202202.TrafficForecastSegment) AdUnitTargeting(com.google.api.ads.admanager.axis.v202202.AdUnitTargeting) InventoryTargeting(com.google.api.ads.admanager.axis.v202202.InventoryTargeting) Targeting(com.google.api.ads.admanager.axis.v202202.Targeting) GeoTargeting(com.google.api.ads.admanager.axis.v202202.GeoTargeting) AdUnitTargeting(com.google.api.ads.admanager.axis.v202202.AdUnitTargeting) Random(java.util.Random) AdjustmentServiceInterface(com.google.api.ads.admanager.axis.v202202.AdjustmentServiceInterface) InventoryTargeting(com.google.api.ads.admanager.axis.v202202.InventoryTargeting) GeoTargeting(com.google.api.ads.admanager.axis.v202202.GeoTargeting) Location(com.google.api.ads.admanager.axis.v202202.Location)

Example 17 with Location

use of com.google.api.ads.admanager.axis.v202202.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);
}
Also used : Location(org.openqa.selenium.html5.Location) Test(org.junit.Test)

Example 18 with Location

use of com.google.api.ads.admanager.axis.v202202.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));
}
Also used : Cut(org.sbolstandard.core2.Cut) GenericLocation(org.sbolstandard.core2.GenericLocation) Range(org.sbolstandard.core2.Range) GenericLocation(org.sbolstandard.core2.GenericLocation) Location(org.sbolstandard.core2.Location) Test(org.junit.Test)

Example 19 with Location

use of com.google.api.ads.admanager.axis.v202202.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="));
}
Also used : GenericLocation(org.sbolstandard.core2.GenericLocation) Location(org.sbolstandard.core2.Location) Test(org.junit.Test)

Example 20 with Location

use of com.google.api.ads.admanager.axis.v202202.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);
}
Also used : GeometryFactory(org.locationtech.jts.geom.GeometryFactory) Coordinate(org.locationtech.jts.geom.Coordinate) Location(de.micromata.opengis.kml.v_2_2_0.Location)

Aggregations

ReportDownloader (com.google.api.ads.admanager.axis.utils.v202202.ReportDownloader)8 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)8 ReportDownloadOptions (com.google.api.ads.admanager.axis.v202202.ReportDownloadOptions)8 ReportJob (com.google.api.ads.admanager.axis.v202202.ReportJob)8 ReportQuery (com.google.api.ads.admanager.axis.v202202.ReportQuery)8 ReportServiceInterface (com.google.api.ads.admanager.axis.v202202.ReportServiceInterface)8 File (java.io.File)8 URL (java.net.URL)8 PublisherQueryLanguageServiceInterface (com.google.api.ads.admanager.axis.v202202.PublisherQueryLanguageServiceInterface)6 ResultSet (com.google.api.ads.admanager.axis.v202202.ResultSet)6 Random (java.util.Random)6 Test (org.junit.Test)3 AdUnitTargeting (com.google.api.ads.admanager.axis.v202108.AdUnitTargeting)2 GeoTargeting (com.google.api.ads.admanager.axis.v202108.GeoTargeting)2 InventoryTargeting (com.google.api.ads.admanager.axis.v202108.InventoryTargeting)2 Location (com.google.api.ads.admanager.axis.v202108.Location)2 NetworkServiceInterface (com.google.api.ads.admanager.axis.v202108.NetworkServiceInterface)2 Targeting (com.google.api.ads.admanager.axis.v202108.Targeting)2 AdUnitTargeting (com.google.api.ads.admanager.axis.v202111.AdUnitTargeting)2 GeoTargeting (com.google.api.ads.admanager.axis.v202111.GeoTargeting)2