/*
* 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.awt.annotation;
import gov.nasa.worldwind.render.AnnotationAttributes;
import java.beans.PropertyChangeListener;
import java.util.Observable;
import org.geoforge.mdl.event.GfrEvtMdlIdAbs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRenamedMlo;
import org.geoforge.mdldsp.event.render.wwd.EnuEvtDspRndWwdEarthShp;
import org.geoforge.mdldsp.event.render.wwd.GfrEvtMdlIdDspRndWwdEarthAbs;
import org.geoforge.mdldsp.render.wwd.GfrMdlDspRndWwdEarthShpAbs;
import org.geoforge.worldwind.render.GfrShouldRedrawRnd;
/**
*
* @author bantchao
*/
abstract public class GfrScreenAnnotationPathDimMloAbs extends GfrScreenAnnotationDimAbs
{
protected String _strIdParent_ = null;
protected GfrScreenAnnotationPathDimMloAbs(
PropertyChangeListener lstShouldRedraw,
String strId,
String strLabel,
String strKindShape,
String strIdParent,
String strSuffixText)
{
super(lstShouldRedraw, strId, strLabel, strKindShape, strSuffixText);
this._strIdParent_ = strIdParent;
}
@Override
public void update(Observable obs, Object objEvt)
{
// data
if (objEvt instanceof GfrEvtMdlIdAbs)
{
GfrEvtMdlIdAbs objId = (GfrEvtMdlIdAbs) objEvt;
String strIdEvt = objId.getId();
if (strIdEvt.compareTo(this._strId_) != 0)
return;
if (objId instanceof GfrEvtMdlIdDatRenamedMlo)
{
GfrEvtMdlIdDatRenamedMlo objRename = (GfrEvtMdlIdDatRenamedMlo) objId;
String strText = objRename.getValueNew();
if (super._strSuffixText != null)
{
strText += "\n";
strText += super._strSuffixText;
}
super.setText(strText);
this.firePropertyChange(GfrShouldRedrawRnd.STR, null, null);
return;
}
}
// display
if (obs instanceof GfrMdlDspRndWwdEarthShpAbs)
{
GfrEvtMdlIdDspRndWwdEarthAbs evt = (GfrEvtMdlIdDspRndWwdEarthAbs) objEvt;
String strId = evt.getId();
if (strId.compareTo(this._strIdParent_) != 0)
return;
if (evt.getWhat() != EnuEvtDspRndWwdEarthShp.ANNOTATION)
return;
String strValue = (String) evt.getValue();
AnnotationAttributes attrs = super.getAttributes();
attrs.setFrameShape(strValue);
this.firePropertyChange(GfrShouldRedrawRnd.STR, null, null);
return;
}
}
}