/*
* 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.mdldatecl;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatAddedLloVarImg;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatChangedGeometry;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRemovedAllLloImgs;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRemovedLloVarImg;
import org.geoforge.mdldat.event.GfrEvtMdlIdDatRenamedLloVar;
import org.geoforge.wrpbasprssynecl.GfrWrpBasSynObjNameTloEclSegWiseYes;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com ... please remove "_AT_" from the above
* string to get the right email address
*/
public class GfrMdlDatIdObjTloEclSegWiseYes extends GfrMdlDatIdObjTloEclAbs
{
static private GfrMdlDatIdObjTloEclSegWiseYes _INSTANCE_ = null;
static public GfrMdlDatIdObjTloEclSegWiseYes getInstance()
{
if (GfrMdlDatIdObjTloEclSegWiseYes._INSTANCE_ == null)
GfrMdlDatIdObjTloEclSegWiseYes._INSTANCE_ = new GfrMdlDatIdObjTloEclSegWiseYes();
return GfrMdlDatIdObjTloEclSegWiseYes._INSTANCE_;
}
// ---
public void changeGeometry(String strId, ArrayList<Point2D.Double> altp2ds) throws Exception
{
if(altp2ds.size() != 2)
throw new RuntimeException("!!!!SegWiseEcl : altp2ds.size() != 2, size =" + altp2ds.size());
Point2D.Double p2dStart = altp2ds.get(0);//!!!
Point2D.Double p2dEnd = altp2ds.get(1);//!!!
GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().setGeometry(
strId, p2dStart, p2dEnd);
super.setChanged();
Object obj = new GfrEvtMdlIdDatChangedGeometry(strId, (Object) altp2ds);
super.notifyObservers(obj);
}
@Override
public void renameImage(
String strIdChild, String strNameNew, String strIdParent) throws Exception
{
GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().renameImage(strIdChild, strNameNew);
super.setChanged();
Object obj = new GfrEvtMdlIdDatRenamedLloVar(strIdChild, strNameNew, strIdParent);
super.notifyObservers(obj);
}
@Override
public void deleteAllImages(String strIdThis) throws Exception
{
GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().deleteAllImages(strIdThis);
super.setChanged();
Object objMrk = new GfrEvtMdlIdDatRemovedAllLloImgs(strIdThis);
super.notifyObservers(objMrk);
}
@Override
public void deleteImage(String strIdThis, String strIdChild) throws Exception
{
GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().deleteImage(strIdChild);
super.setChanged();
Object obj = new GfrEvtMdlIdDatRemovedLloVarImg(strIdChild, strIdThis);
super.notifyObservers(obj);
}
@Override
public String cloneObjectImage(
String strIdParent,
String strIdImageSource) throws Exception
{
String strIdChild = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().cloneImage(
strIdParent, strIdImageSource);
super.setChanged();
//-- Not sure about this, may be specialise event as clone???
Object obj = new GfrEvtMdlIdDatAddedLloVarImg(strIdChild, strIdParent);
super.notifyObservers(obj);
return strIdChild;
}
@Override
public String newObjectImage(
String strIdParent,
String strValue,
String strPathAbsSource) throws Exception
{
String strIdChild = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().saveImage(
strIdParent, strValue, strPathAbsSource);
super.setChanged();
Object obj = new GfrEvtMdlIdDatAddedLloVarImg(strIdChild, strIdParent);
super.notifyObservers(obj);
return strIdChild;
}
@Override
public void rename(String strId, String strNameNew)
throws Exception
{
GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().rename(strId, strNameNew);
super.rename(strId, strNameNew);
}
private GfrMdlDatIdObjTloEclSegWiseYes()
{
super();
}
}