/*
* 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.mdldspecl.render.wwd;
import java.awt.Color;
import org.geoforge.awt.color.GfrColorFactory;
import org.geoforge.mdldsp.event.render.wwd.EnuEvtDspRndWwdEarthShp;
import org.geoforge.mdldsp.event.render.wwd.EnuEvtDspRndWwdEarthShpDimOne;
import org.geoforge.mdldsp.event.render.wwd.GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint;
import org.geoforge.mdldsp.render.wwd.GfrMdlDspRndWwdEarthShpDimOnePointAbs;
import org.geoforge.wrpbasprsdsp.render.wwd.GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle;
import org.geoforge.wrpbasprsdspecl.render.wwd.GfrWrpRndDftWwdEarthShpDimOnePointPnt;
import org.geoforge.wrpbasprssynecl.GfrWrpBasTopSynEclPnts;
/**
*
* @author bantchao
*/
public class GfrMdlDspRndWwdEarthShpDimOnePointEclPnt extends GfrMdlDspRndWwdEarthShpDimOnePointAbs
{
static private GfrMdlDspRndWwdEarthShpDimOnePointEclPnt _INSTANCE_;
static public GfrMdlDspRndWwdEarthShpDimOnePointEclPnt getInstance()
{
if (_INSTANCE_ == null)
{
_INSTANCE_ = new GfrMdlDspRndWwdEarthShpDimOnePointEclPnt();
}
return _INSTANCE_;
}
// beg public
@Override
public void setColor(String strId,
Color colValue, // nil value NOT allowed
boolean blnApplyToAll, boolean blnSetAsDefault) throws Exception
{
if (colValue == null)
throw new Exception("colValue == null");
if (blnSetAsDefault)
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setColor(colValue);
if (blnApplyToAll)
{
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setColor(strs, colValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShpDimOne.COLOR, colValue);
super.notifyObservers(objEvt);
}
}
else
{
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setColor(strId, colValue);
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strId, EnuEvtDspRndWwdEarthShpDimOne.COLOR, colValue);
super.notifyObservers(objEvt);
}
}
@Override
public void setTransparency(String strId, float fltValue,
boolean blnApplyToAll, boolean blnSetAsDefault) throws Exception
{
if (blnSetAsDefault)
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setTransparency(fltValue);
Float flo = new Float(fltValue);
if (blnApplyToAll)
{
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTransparency(strs, fltValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShpDimOne.TRANSPARENCY, flo);
super.notifyObservers(objEvt);
}
}
else
{
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTransparency(strId, fltValue);
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strId, EnuEvtDspRndWwdEarthShpDimOne.TRANSPARENCY, flo);
super.notifyObservers(objEvt);
}
}
@Override
public void setKindAnnotation(String strId, String strValue,
boolean blnApplyToAll, boolean blnSetAsDefault) throws Exception
{
if (blnSetAsDefault)
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setKindAnnotation(strValue);
if (blnApplyToAll)
{
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setKindAnnotation(strs, strValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShp.ANNOTATION, strValue);
super.notifyObservers(objEvt);
}
}
else
{
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setKindAnnotation(strId, strValue);
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strId, EnuEvtDspRndWwdEarthShp.ANNOTATION, strValue);
super.notifyObservers(objEvt);
}
}
@Override
public void setTooltip(String strId, boolean blnValue,
boolean blnApplyToAll, boolean blnSetAsDefault) throws Exception
{
if (blnSetAsDefault)
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setTooltip(blnValue);
Boolean boo = Boolean.valueOf(blnValue);
if (blnApplyToAll)
{
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTooltip(strs, blnValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShp.TOOLTIP, boo);
super.notifyObservers(objEvt);
}
}
else
{
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTooltip(strId, blnValue);
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strId, EnuEvtDspRndWwdEarthShp.TOOLTIP, boo);
super.notifyObservers(objEvt);
}
}
@Override
public void setColorDefault(Color colValue, boolean blnApplyToAll) throws Exception
{
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setColor(colValue);
if (! blnApplyToAll)
return;
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
if (colValue != null)
{
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setColor(strs, colValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShpDimOne.COLOR, colValue);
super.notifyObservers(objEvt);
}
return;
}
// random color
for (int i=0; i<strs.length; i++)
{
Color colCur = GfrColorFactory.s_getRandom();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setColor(strs[i], colCur);
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShpDimOne.COLOR, colCur);
super.notifyObservers(objEvt);
}
}
@Override
public void setTransparencyDefault(float fltValue, boolean blnApplyToAll) throws Exception
{
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setTransparency(fltValue);
if (! blnApplyToAll)
return;
Float flo = new Float(fltValue);
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTransparency(strs, fltValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShpDimOne.TRANSPARENCY, flo);
super.notifyObservers(objEvt);
}
}
@Override
public void setKindAnnotationDefault(String strValue, boolean blnApplyToAll) throws Exception
{
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setKindAnnotation(strValue);
if (! blnApplyToAll)
return;
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setKindAnnotation(strs, strValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShp.ANNOTATION, strValue);
super.notifyObservers(objEvt);
}
}
@Override
public void setTooltipDefault(boolean blnValue, boolean blnApplyToAll) throws Exception
{
GfrWrpRndDftWwdEarthShpDimOnePointPnt.getInstance().setTooltip(blnValue);
if (! blnApplyToAll)
return;
Boolean boo = Boolean.valueOf(blnValue);
String[] strs = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();
GfrWrpBasPrsDspPrjRndWwdEarthShpDimOnePointCircle.getInstance().setTooltip(strs, blnValue);
for (int i=0; i<strs.length; i++)
{
super.setChanged();
Object objEvt = new GfrEvtMdlIdDspRndWwdEarthShpDimOnePoint(strs[i], EnuEvtDspRndWwdEarthShp.TOOLTIP, boo);
super.notifyObservers(objEvt);
}
}
// beg private
private GfrMdlDspRndWwdEarthShpDimOnePointEclPnt()
{
super();
}
}