/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillcogceclgsi.panel;
import gov.nasa.worldwind.event.SelectListener;
import gov.nasa.worldwind.geom.LatLon;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.layers.Layer;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.logging.Logger;
import org.geoforge.guillcogcecl.panel.GfrPnlMainWwdOgcSecMovObjEclAbs;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mdldatecl.*;
import org.geoforge.worldwind.layer.*;
import org.geoforge.worldwindecl.layer.*;
/**
*
* @author bantchao
*/
public class GfrPnlMainWwdOgcSecMovObjsEclGsi extends GfrPnlMainWwdOgcSecMovObjEclAbs
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrPnlMainWwdOgcSecMovObjsEclGsi.class.getName());
static
{
GfrPnlMainWwdOgcSecMovObjsEclGsi._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
public GfrPnlMainWwdOgcSecMovObjsEclGsi(String strIdViewerSource) throws Exception
{
super(strIdViewerSource);
}
@Override
protected void _updateGeometry(Layer lyr)
{
try
{
if (! (lyr instanceof GfrRlrObjTloAbs))
{
GfrPnlMainWwdOgcSecMovObjsEclGsi._LOGGER_.warning("Uncaught instanceof lyr: " + lyr.getClass().getName());
return;
}
GfrRlrObjTloAbs rlrGfr = (GfrRlrObjTloAbs) lyr;
String strId = rlrGfr.getIdObjectGeoforgeWwdEarth();
if (lyr instanceof GfrRlrObjTloRndMltPntCircleAbs)
{
ArrayList<Position> altPos = ((GfrRlrObjTloRndMltPntCircleAbs) lyr).getPositionsRenderableObjects();
// beg ecl
if (lyr instanceof GfrRlrObjTloRndMltPntCircleSpn)
{
GfrMdlDatIdObjTloEclSpn.getInstance().changeGeometry(strId, altPos);
return;
}
// end ecl
// beg gsi
// end gsi
}
if (lyr instanceof GfrRlrObjTloRndSngSurfaceAbs)
{
Iterable<? extends LatLon> itrLatLon = ((GfrRlrObjTloRndSngSurfaceAbs) lyr).getLocationsRenderableObject();
ArrayList<Point2D.Double> altPoint2d = new ArrayList<Point2D.Double>();
for (LatLon llnCur: itrLatLon)
{
Point2D.Double p2dCur = new Point2D.Double();
p2dCur.x = llnCur.longitude.degrees;
p2dCur.y = llnCur.latitude.degrees;
altPoint2d.add(p2dCur);
}
// beg ecl
if (lyr instanceof GfrRlrObjTloRndSngSurfaceSectorSct)
{
GfrMdlDatIdObjTloEclSct.getInstance().changeGeometry(strId, altPoint2d);
return;
}
if (lyr instanceof GfrRlrObjTloRndSngSurfacePolygonAre)
{
GfrMdlDatIdObjTloEclAre.getInstance().changeGeometry(strId, altPoint2d);
return;
}
if (lyr instanceof GfrRlrObjTloRndSngSurfaceLineSegWiseYesEcl)
{
GfrMdlDatIdObjTloEclSegWiseYes.getInstance().changeGeometry(strId, altPoint2d);
return;
}
if (lyr instanceof GfrRlrObjTloRndSngSurfacePolylinePth)
{
GfrMdlDatIdObjTloEclPth.getInstance().changeGeometry(strId, altPoint2d);
return;
}
// end ecl
GfrPnlMainWwdOgcSecMovObjsEclGsi._LOGGER_.warning("uncaught instanceof GfrRlrShpTloSingleAbs: " + lyr.getClass().getName());
return;
}
if (lyr instanceof GfrRlrObjTloRndSngPntAbs)
{
Position posNew = ((GfrRlrObjTloRndSngPntAbs) lyr).getPositionRenderableObject();
Point2D.Double dou = new Point2D.Double();
dou.x = posNew.longitude.degrees;
dou.y = posNew.latitude.degrees;
// beg ecl
if (lyr instanceof GfrRlrObjTloRndSngPntPnt)
{
GfrMdlDatIdObjTloEclPnt.getInstance().changeGeometry(strId, dou);
return;
}
if (lyr instanceof GfrRlrObjTloRndSngPntPlc)
{
GfrMdlDatIdObjTloEclPlc.getInstance().changeGeometry(strId, dou);
return;
}
// end ecl
// beg gsi
// end gsi
GfrPnlMainWwdOgcSecMovObjsEclGsi._LOGGER_.warning("uncaught instanceof GfrRlrPptSinglePointAbs: " + lyr.getClass().getName());
return;
}
GfrPnlMainWwdOgcSecMovObjsEclGsi._LOGGER_.warning("uncaught instanceof GfrRlrAbs: " + lyr.getClass().getName());
}
catch(Exception exc)
{
exc.printStackTrace();
}
}
}