/*
* 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.worldwind.layer;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.layers.RenderableLayer;
import gov.nasa.worldwind.render.Renderable;
import java.util.Iterator;
import org.geoforge.lang.handler.IGfrHandlerLifeCycleObject;
import org.geoforge.worldwind.handler.IGfrHandlerWwdEarthObjectGeoforgeRenderableLayer;
/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrRlrObjTloAbs extends RenderableLayer implements
IGfrHandlerLifeCycleObject,
IGfrHandlerWwdEarthObjectGeoforgeRenderableLayer
{
protected String _strId = null; // !!!!!!!!!!! also in shape! just in use while calling _add()
@Override
public String getIdObjectGeoforgeWwdEarth() { return this._strId; }
@Override
abstract public Position getPositionBarycentricObjectGeoforgeWwdEarth() throws Exception;
@Override
abstract public double getCharacteristicDimensionObjectGeoforgeRenderableLayer() throws Exception;
abstract public void setVisibleAnnotation(boolean bln);
protected GfrRlrObjTloAbs(String strId) throws Exception
{
super();
this._strId = strId;
}
@Override
public boolean init()
{
return true;
}
@Override
public void destroy()
{
Iterator<Renderable> itr = super.getRenderables().iterator();
while (itr.hasNext())
{
Renderable rndCur = itr.next();
super.removeRenderable(rndCur);
if (rndCur instanceof IGfrHandlerLifeCycleObject)
((IGfrHandlerLifeCycleObject) rndCur).destroy();
}
super.dispose();
}
}