Java Sensor Projection Data Providers

« Go Back

Information

 
Notes/Code
//get the current scenario properties
iagstkobject scenobject = new agstkobject(this.m_iagscenario);

//get the current satellite to attach a sensor to
iagstkobjectcollection scenobjects = scenobject.getchildren();
agvariant varsat = new agvariant(s_sat_name);
iagstkobject objsat = scenobjects.getitem(varsat);

//attach a new sensor object to the satellite
iagstkobject mysensorobject = objsat.getchildren()._new(agestkobjecttype.esensor, s_sensor_name);
iagsensor mysensor = new agsensor(mysensorobject);

//define the sensor pattern
mysensor.setpatterntype(agesnpattern.esnrectangular); 
iagsnpattern mypattern = mysensor.getpattern(); 
iagsnrectangularpattern rectsensor = new agsnrectangularpattern(mypattern);
rectsensor.setverticalhalfangle(new agvariant(this.horz_angle));
rectsensor.sethorizontalhalfangle(new agvariant(this.vert_angle));

//define the sensor pointing type
mysensor.setpointingtype(agesnpointing.esnptfixed); 
iagsnpointing mypointing = mysensor.getpointing();
iagsnptfixed myfixed = new agsnptfixed(mypointing);
myfixed.getorientation().assignazel(new agvariant(this.az),new agvariant(this.el), boresight);

//set the graphics of the sensor
iagsngraphics sensgraphics = mysensor.getgraphics();

//set the 3d properties of the sensor
iagsnvo sensvo = mysensor.getvo();
sensvo.setinheritfrom2d(1);
sensgraphics.setcolor(255); //red

//set the projection of the sensor
iagsnprojection myproj = sensgraphics.getprojection();
myproj.setusedistance(true);
myproj.setdistancetype(agesnprojectiondistancetype.econstantalt);
myproj.setforwardpersistence(true);
myproj.setpersistence(persist);
string sensoraltitude = textfield.gettext();
double sensoraltitudedouble = double.parsedouble(sensoraltitude);
iagdisplaydistance dist = myproj.getdistancedata();
iagsnprojdisplaydistance mydist = new agsnprojdisplaydistance(dist);
mydist.setmax(sensoraltitudedouble);
mydist.setmin(0);
mydist.setnumberofsteps(1);
mydist.setprojectsthrucrossing(false);
System.out.println("Get Data Providers");
IAgStkObject scenObject = new AgStkObject(this.m_IAgScenario);
IAgStkObjectCollection scenObjects = scenObject.getChildren();
IAgStkObject objsat = scenObjects.getItem(new AgVariant(s_SAT_NAME));
IAgStkObject mySensorObject = objsat.getChildren().getItem(new AgVariant(s_SENSOR_NAME));
IAgDataProviderCollection sens_dpc = mySensorObject.getDataProviders();
IAgDataProviderInfo sens_dpi = sens_dpc.getItem(new AgVariant(25));//get the 26th dp (Pattern Intersection)
System.out.println(sens_dpi.getName());

//IAgDataProvider sensProv = new AgDataProvider(sens_dpi);
IAgDataPrvTimeVar LLAfixed = new AgDataPrvTimeVarClass(sens_dpi);
AgVariant startTime = new AgVariant(this.m_StartTime);
AgVariant stopTime = new AgVariant(this.m_StopTime);
double timeStep = 60;

//IAgDataPrvTimeVar var = new AgDataPrvTimeVarClass( dpiJ2000 );
IAgDrResult result = LLAfixed.exec( startTime, stopTime, timeStep );
IAgDrDataSetCollection ddsc = result.getDataSets();
int numddsc = ddsc.getCount();
System.out.println(Double.toString(numddsc));
IAgDrDataSet lat = ddsc.getItem(0);
int lat_count = lat.getCount();
System.out.println(lat_count);
AgVariant[] lat_values = lat.getValues().getVariantArray();
for(int i = 0; i < lat_values.length; i++ )
{
System.out.println(lat_values[i].getDouble());
}
IAgDrDataSet lon = ddsc.getItem(1);
int lon_count = lon.getCount();
System.out.println(lon_count);
AgVariant[] lon_values = lon.getValues().getVariantArray();
for(int i = 0; i < lon_values.length; i++ )
{
System.out.println(lon_values[i].getDouble());
}
IAgDrDataSet alt = ddsc.getItem(2);
int alt_count = alt.getCount();
System.out.println(alt_count);
AgVariant[] alt_values = alt.getValues().getVariantArray();
for(int i = 0; i < alt_values.length; i++ )
{
System.out.println(alt_values[i].getDouble());
}
Download File