/*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.geoforge.worldwind.render;
import gov.nasa.worldwind.WorldWind;
import gov.nasa.worldwind.geom.Position;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatChangedGeometry;
/**
*
* @author bantchao
*/
abstract public class GfrLabeledPathRndDimTwoTloAbs extends GfrLabeledPathRndDimAbs implements
Observer
{
private String _strIdTlo_ = null;
protected GfrLabeledPathRndDimTwoTloAbs( String strIdTlo) throws Exception
{
super();
this._strIdTlo_ = strIdTlo;
super.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
}
@Override
public void update(Observable obs, Object objEvt)
{
if (! (objEvt instanceof GfrEvtMdlIdDatChangedGeometry))
return;
GfrEvtMdlIdDatChangedGeometry evt = (GfrEvtMdlIdDatChangedGeometry) objEvt;
String strId = evt.getId();
if (strId.compareTo(this._strIdTlo_) != 0)
return;
ArrayList<Point2D.Double> lstP2d = (ArrayList<Point2D.Double>) evt.getGeometry();
List<Position> lstPosition = new ArrayList<Position>();
for (Point2D.Double p2dCur: lstP2d)
{
Position posCur = Position.fromDegrees(p2dCur.y, p2dCur.x);
lstPosition.add(posCur);
}
super.setLocations(lstPosition);
}
}