Package org.geoforge.appogcecl.actionperformer

Source Code of org.geoforge.appogcecl.actionperformer.ActPrfPrjConstructOgcEclAbs

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.geoforge.appogcecl.actionperformer;

import gov.nasa.worldwind.geom.LatLon;
import java.awt.event.ActionEvent;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import org.geoforge.guillc.dialog.GfrDlgNewSettingsTlo;
import org.geoforge.guillc.dialog.GfrDlgNewSettingsTloUrlAbs;
import org.geoforge.guillc.dialog.GfrDlgNewSettingsTloUrlPointEdit;
import org.geoforge.guillc.dialog.GfrDlgOkNewAbs;
import org.geoforge.guillc.enumeration.GfrEnuValuesKindTargetWindow;
import org.geoforge.guillc.frame.GfrFrmAbs;
import org.geoforge.guillc.internalframe.GfrIfrAbs;
import org.geoforge.guillc.internalframe.GfrIfrWinViewRunIdRegSerAbs;
import org.geoforge.guillc.internalframe.GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrNewDrg;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrNewEdt;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrNewPik;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillcogcecl.dialog.*;
import org.geoforge.guillcogcecl.enumeration.GfrEnuValuesKindObjectTloSpcPrjOgcEcl;
import org.geoforge.guillcogcecl.frame.GfrFrmMainAppOgcEclAbs;
import org.geoforge.io.serial.GfrSerializeStateWwdMan;
import org.geoforge.io.serial.GfrSerializeStateWwdSec;
import org.geoforge.io.serial.GfrSerializeStateWwdSel;
import org.geoforge.lang.enumeration.GfrEnuApplicationPropertiesImmutableKeys;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mdldatecl.*;
import org.geoforge.wrpbasprssynecl.*;

/**
*
* @author robert
*/
abstract public class ActPrfPrjConstructOgcEclAbs extends ActPrfPrjConstructOgcAbs
{
   // ----
   // begin: instantiate logger for this class

   final private static Logger _LOGGER_ = Logger.getLogger(ActPrfPrjConstructOgcEclAbs.class.getName());

   static
   {
      ActPrfPrjConstructOgcEclAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }
   // end: instantiate logger for this class
   // ----

   abstract protected void _newMouseDraggedTloSctEclMan(JFrame frmOwner) throws Exception;

   abstract protected void _newMouseDraggedTloSctEclSel(JFrame frmOwner) throws Exception;

   abstract protected void _newMouseDraggedTloSctEclSec(String strIdViewerSource) throws Exception;

   abstract protected void _newMousePickedTloAreEclMan(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloAreEclSel(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloAreEclSec(String strIdViewerSource) throws Exception;

   abstract protected void _newMousePickedTloPthEclMan(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloPthEclSel(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloPthEclSec(String strIdViewerSource) throws Exception;

   abstract protected void _newMousePickedTloSegWiseYesEclMan(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloSegWiseYesEclSel(JFrame frmOwner) throws Exception;

   abstract protected void _newMousePickedTloSegWiseYesEclSec(String strIdViewerSource) throws Exception;

   abstract protected void _newMousePickedTloPntEclSec(String strIdViewerSource) throws Exception;

   abstract protected void _newMousePickedTloPlcEclSec(String strIdViewerSource) throws Exception;

   @Override
   public boolean doneJob(ActionEvent evt) throws Exception
   {
      if (super.doneJob(evt))
         return true;


      if (evt.getSource() instanceof GfrMimTrsAlrNewPik)
      {

         GfrMimTrsAlrNewPik mim = (GfrMimTrsAlrNewPik) evt.getSource();

         String strValueKindObject = mim.getPropertyImmutable(
               GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_OBJECT.name());

         String strValueKindTargetWindow = mim.getPropertyImmutable(
               GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_TARGET_WINDOW.name());

         //--
         if (strValueKindObject == null || strValueKindObject.length() < 1)
            return false;
         if (strValueKindTargetWindow == null || strValueKindTargetWindow.length() < 1)
            return false;
         //--



         //-- beg segWiseYes piking
         /*
          * either located in external frame or internal frame !
          *
          * memo: external frames could be removed in the future
          */
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SEG_WISE_YES.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloSegWiseYesEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloSegWiseYesEclSel(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {

               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMousePickedTloSegWiseYesEclSec(strIdViewerSource);
                  return true;
               }
               else
               {
                  // !!!!!!!!!!!!!!!!!!
               }
            }




         }
         //-- end segWiseYes piking


         //-- beg pointset by picking
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SPN.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               String strTodo = "TODO: GfrMimTrsNewTloPickedSpnManWwdEarth";
               ActPrfPrjConstructOgcEclAbs._LOGGER_.warning(strTodo);
               GfrOptionPaneAbs.s_showDialogInfo(null, strTodo);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               String strTodo = "TODO: GfrMimTrsNewTloPickedSpnSelWwdEarth";
               ActPrfPrjConstructOgcEclAbs._LOGGER_.warning(strTodo);
               GfrOptionPaneAbs.s_showDialogInfo(null, strTodo);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               String strTodo = "TODO: GfrMimTrsNewTloPickedSpnSecWwdEarth";
               ActPrfPrjConstructOgcEclAbs._LOGGER_.warning(strTodo);
               GfrOptionPaneAbs.s_showDialogInfo(null, strTodo);
               return true;
            }
         }
         //-- end pointset by picking

         //-- beg area by picking
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_ARE.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloAreEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloAreEclSel(frmOwner);
               return true;
            }

            /*
             * either located in external frame or internal frame !
             *
             * memo: external frames could be removed in the future
             */
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMousePickedTloAreEclSec(strIdViewerSource);
                  return true;
               }
            }
         }
         //-- end area by picking

         //-- beg path by picking
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PTH.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloPthEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloPthEclSel(frmOwner);
               return true;
            }

            /*
             * either located in external frame or internal frame !
             *
             * memo: external frames could be removed in the future
             */
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMousePickedTloPthEclSec(strIdViewerSource);
                  return true;
               }
               else
               {
                  // !!!!!!!!!!!!!!!!!!
               }
            }
         }
         //-- end path by picking



         //-- beg placemark by picking
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PLC.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloPlcEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);

               _newMousePickedTloPlcEclSel(frmOwner);
               return true;
            }



            /*
             * either located in external frame or internal frame !
             *
             * memo: external frames could be removed in the future
             */
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMousePickedTloPlcEclSec(strIdViewerSource);
                  return true;
               }
               else
               {
                  // !!!!!!!!!!!!!!!!!!
               }

               return true;
            }
         }
         //-- end placemark by picking


         //-- beg point by picking
         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PNT.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloPntEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);
               _newMousePickedTloPntEclSel(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMousePickedTloPntEclSec(strIdViewerSource);
                  return true;
               }
               else
               {
                  // !!!!!!!!!!!!!!!!!!
               }

               return true;
            }
         }
         //-- end point by picking
      }


      //---beg New by editing tlo

      if (evt.getSource() instanceof GfrMimTrsAlrNewEdt)
      {

         GfrMimTrsAlrAbs mim = (GfrMimTrsAlrAbs) evt.getSource();
         JFrame frmOwner = GfrFrmAbs.s_getFrameOwnerTrickForActionController(mim);

         String strValueKindObject = mim.getPropertyImmutable(
               GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_OBJECT.name());

         //--
         if (strValueKindObject == null || strValueKindObject.length() < 1)
            return false;

         //--

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SEG_WISE_YES.name()) == 0)
         {

            _newEditTloEclSegWiseYes_(frmOwner);
            return true;
         }

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SCT.name()) == 0)
         {
            _newEditTloEclSct_(frmOwner);
            return true;
         }

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SPN.name()) == 0)
         {
            _newEditTloEclSpn_(frmOwner);
            return true;
         }


         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_ARE.name()) == 0)
         {
            _newEditTloEclAre_(frmOwner);
            return true;
         }

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PTH.name()) == 0)
         {
            _newEditTloEclPth_(frmOwner);
            return true;
         }

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PNT.name()) == 0)
         {
            _newEditTloEclPnt_(frmOwner);
            return true;
         }

         if (strValueKindObject.compareTo(GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_PLC.name()) == 0)
         {
            _newEditTloEclPlc_(frmOwner);
            return true;
         }

      }

      //---end New by editing tlo

      // --


      if (evt.getSource() instanceof GfrMimTrsAlrNewDrg)
      {
         GfrMimTrsAlrAbs mim = (GfrMimTrsAlrAbs) evt.getSource();

         String strValueKindObject = mim.getPropertyImmutable(
               GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_OBJECT.name());

         String strValueKindTargetWindow = mim.getPropertyImmutable(
               GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_TARGET_WINDOW.name());

         //--
         if (strValueKindObject == null || strValueKindObject.length() < 1)
            return false;
         if (strValueKindTargetWindow == null || strValueKindTargetWindow.length() < 1)
            return false;
         //--

         if (strValueKindObject.compareTo(
               GfrEnuValuesKindObjectTloSpcPrjOgcEcl.VALUE_TLO_ECL_SCT.name()) == 0)
         {
            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.VIEWER_TOP_WORLDWIND.name()) == 0)
            {
               JInternalFrame ifrOwner = GfrIfrAbs.s_getInternalFrameOwner(mim);
               String strIdViewerSource = null;

               if (ifrOwner != null)
               {
                  strIdViewerSource = ((GfrIfrWinViewRunIdRegSerAbs) ifrOwner).getUniqueId();
                  GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs frm = (GfrIfrWinViewRunIdRegSerAppTopsWwdEarthAbs) ifrOwner;
                  String strStateOrbitViewSource = frm.getRestorableStateOrbitView();

                  if (strStateOrbitViewSource != null)
                  {
                     GfrSerializeStateWwdSec.s_write(strStateOrbitViewSource, strIdViewerSource);
                  }

                  _newMouseDraggedTloSctEclSec(strIdViewerSource);
                  return true;
               }
            }


            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_MANAGE.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);

               _newMouseDraggedTloSctEclMan(frmOwner);
               return true;
            }

            if (strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_SELECT.name()) == 0
                  || strValueKindTargetWindow.compareTo(
                  GfrEnuValuesKindTargetWindow.PERSPECTIVE_RUN.name()) == 0)
            {
               JFrame frmOwner = GfrFrmAbs.s_getFrameOwner(mim);

               _newMouseDraggedTloSctEclSel(frmOwner);
               return true;
            }
         }
      }



      // ending
      return false;
   }

   // ---
   protected ActPrfPrjConstructOgcEclAbs()
   {
      super();
   }

   protected void _newMousePickedTloAreStepTwo(JFrame frmOwner, ArrayList<LatLon> alt) throws Exception
   {
      // step 2/2

      if (alt.size() < 4)
      {
         String str = "alt.size() < 4: " + alt.size();
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      // memo: don't take last point coz same location as first one!
      alt.remove(alt.size() - 1);


      Double[] dblsX = new Double[alt.size()];
      Double[] dblsY = new Double[alt.size()];


      for (int i = 0; i < alt.size(); i++)
      {
         LatLon llnCur = alt.get(i);
         double[] dblsCur = llnCur.asDegreesArray();

         dblsX[i] = dblsCur[0];
         dblsY[i] = dblsCur[1];
      }

      // step 2



      String[] strsChildrenExisting = GfrWrpBasTopSynEclAres.getInstance().getSortedNamesTlo();

      GfrDlgNewSettingsTloUrlPicksLinClsEclAre dlg = new GfrDlgNewSettingsTloUrlPicksLinClsEclAre(
            frmOwner, (String[]) strsChildrenExisting, dblsX, dblsY);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);


      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altValueLine = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altValueLine = dlg.getValueLine();
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclAre.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            altValueLine);
   }

   protected void _newMouseDraggedTloSctStepTwo(JFrame frmOwner, ArrayList<LatLon> alt) throws Exception
   {
      // step 2/2

      if (alt.size() != 2)
      {
         String str = "alt.size() != 2: " + alt.size();
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }


      // step 2



      String[] strsChildrenExisting = GfrWrpBasTopSynEclScts.getInstance().getSortedNamesTlo();

      GfrDlgNewSettingsTloUrlPnts2SctFilled dlg = new GfrDlgNewSettingsTloUrlPnts2SctFilled(
            frmOwner, (String[]) strsChildrenExisting, alt);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);


      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altValue = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altValue = dlg.getGeometry(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclSct.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            altValue);
   }

   protected void _newMousePickedTloPntStepTwo(JFrame frmOwner, LatLon lln) throws Exception
   {
      double dblLat = lln.getLatitude().getDegrees();
      double dblLon = lln.getLongitude().getDegrees();

      String[] strsChildrenExisting = GfrWrpBasTopSynEclPnts.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgOkNewAbs dlg = new GfrDlgNewSettingsTloUrlPointFilled(
            frmOwner, (String[]) strsChildrenExisting, dblLat, dblLon,
            "New point",
            "point");

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double dblGeometry = null;
      String strDescShort = null;
      String strUrl = null;


      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         dblGeometry = ((GfrDlgNewSettingsTloUrlPointFilled) dlg).getGeometry(); // !!!!!!!! same as input !!!!!!!!!!
         strDescShort = ((GfrDlgNewSettingsTlo) dlg).getValueDescShort();
         strUrl = ((GfrDlgNewSettingsTloUrlAbs) dlg).getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPnt.getInstance().newObject(strValue, strDescShort, strUrl, dblGeometry);
   }

   protected void _newMousePickedTloPlcStepTwo(JFrame frmOwner, LatLon lln) throws Exception
   {
      double dblLat = lln.getLatitude().getDegrees();
      double dblLon = lln.getLongitude().getDegrees();

      String[] strsChildrenExisting = GfrWrpBasTopSynEclPlcs.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgOkNewAbs dlg = new GfrDlgNewSettingsTloUrlPointFilled(
            frmOwner, (String[]) strsChildrenExisting, dblLat, dblLon,
            "New placemark",
            "placemark");

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double dblGeometry = null;
      String strDescShort = null;
      String strUrl = null;


      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         dblGeometry = ((GfrDlgNewSettingsTloUrlPointFilled) dlg).getGeometry(); // !!!!!!!! same as i,put !!!!!!!!!!
         strDescShort = ((GfrDlgNewSettingsTlo) dlg).getValueDescShort();
         strUrl = ((GfrDlgNewSettingsTloUrlAbs) dlg).getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPlc.getInstance().newObject(strValue, strDescShort, strUrl, dblGeometry);
   }

   protected void _newMousePickedTloPthStepTwo(JFrame frmOwner, ArrayList<LatLon> alt) throws Exception
   {
      // step 2/2

      if (alt.size() < 2)
      {
         String str = "alt.size() < 2: " + alt.size();
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }


      Double[] dblsX = new Double[alt.size()];
      Double[] dblsY = new Double[alt.size()];


      for (int i = 0; i < alt.size(); i++)
      {
         LatLon llnCur = alt.get(i);
         double[] dblsCur = llnCur.asDegreesArray();

         dblsX[i] = dblsCur[0];
         dblsY[i] = dblsCur[1];
      }

      // step 2


      String[] strsChildrenExisting = GfrWrpBasTopSynEclPths.getInstance().getSortedNamesTlo();

      GfrDlgNewSettingsTloUrlPicksLinOpnEclPth dlg = new GfrDlgNewSettingsTloUrlPicksLinOpnEclPth(
            frmOwner, (String[]) strsChildrenExisting, dblsX, dblsY);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);


      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altValueLine = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altValueLine = dlg.getValueLine();
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPth.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            altValueLine);
   }

   protected void _newMousePickedTloSegWiseYesStepTwo(JFrame frmOwner, ArrayList<LatLon> alt) throws Exception
   {
      // step 2/2

      if (alt.size() != 2)
      {
         String str = "alt.size() != 2: " + alt.size();
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      Double[] dblsX = new Double[alt.size()];
      Double[] dblsY = new Double[alt.size()];


      for (int i = 0; i < alt.size(); i++)
      {
         LatLon llnCur = alt.get(i);
         double[] dblsCur = llnCur.asDegreesArray();

         dblsX[i] = dblsCur[0];
         dblsY[i] = dblsCur[1];
      }

      // step 2


      String[] strsChildrenExisting = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getSortedNamesTlo();

      GfrDlgNewSettingsTloSegWiseYesEcl dlg = new GfrDlgNewSettingsTloSegWiseYesEcl(
            frmOwner, (String[]) strsChildrenExisting,
            alt.get(0), alt.get(1));

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);


      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double p2dStart = null;
      Point2D.Double p2dEnd = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValueName();
         p2dStart = dlg.getGeometryPointStart();
         p2dEnd = dlg.getGeometryPointEnd();
         strDescShort = dlg.getValueTloAbstract();
         strUrl = "";//tempo
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclSegWiseYes.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            p2dStart,
            p2dEnd);
   }

   // ---
   private void _newEditTloEclAre_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclAres.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgNewSettingsTloEclEditLineArea dlg = new GfrDlgNewSettingsTloEclEditLineArea(
            frmOwner, (String[]) strsChildrenExisting);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altPoint2d = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altPoint2d = dlg.getValueLine();
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclAre.getInstance().newObject(strValue, strDescShort, strUrl, altPoint2d);

   }

   private void _newEditTloEclPth_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclPths.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgNewSettingsTloEclEditLinePath dlg = new GfrDlgNewSettingsTloEclEditLinePath(
            frmOwner,
            strsChildrenExisting);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altPoint2d = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altPoint2d = dlg.getValueLine();
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPth.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            altPoint2d);
   }

   private void _newEditTloEclSpn_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclSpns.getInstance().getSortedNamesTlo();


      // show dialog
      GfrDlgNewSettingsTloUrlEditPointsSpn dlg = new GfrDlgNewSettingsTloUrlEditPointsSpn(
            frmOwner,
            strsChildrenExisting);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> altPoint2d = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         altPoint2d = dlg.getValueLine();
         strDescShort = dlg.getValueDescShort();
         strUrl = dlg.getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclSpn.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            altPoint2d);
   }

   private void _newEditTloEclPnt_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclPnts.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgOkNewAbs dlg = new GfrDlgNewSettingsTloUrlPointEdit(
            frmOwner, (String[]) strsChildrenExisting,
            "New point",
            "point");

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double dblGeometry = null;
      String strDescShort = null;
      String strUrl = null;


      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         dblGeometry = ((GfrDlgNewSettingsTloUrlPointEdit) dlg).getGeometry();
         strDescShort = ((GfrDlgNewSettingsTlo) dlg).getValueDescShort();
         strUrl = ((GfrDlgNewSettingsTloUrlAbs) dlg).getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPnt.getInstance().newObject(strValue, strDescShort, strUrl, dblGeometry);
   }

   private void _newEditTloEclPlc_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclPlcs.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgOkNewAbs dlg = new GfrDlgNewSettingsTloUrlPointEdit(
            frmOwner,
            (String[]) strsChildrenExisting,
            GfrResBundleLang.s_getInstance().getValue("sentence.newPlacemark"),
            GfrResBundleLang.s_getInstance().getValue("word.placemark"));

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double dblGeometry = null;
      String strDescShort = null;
      String strUrl = null;


      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         dblGeometry = ((GfrDlgNewSettingsTloUrlPointEdit) dlg).getGeometry();
         strDescShort = ((GfrDlgNewSettingsTlo) dlg).getValueDescShort();
         strUrl = ((GfrDlgNewSettingsTloUrlAbs) dlg).getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclPlc.getInstance().newObject(strValue, strDescShort, strUrl, dblGeometry);
   }

   private void _newEditTloEclSegWiseYes_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgNewSettingsTloSegWiseYesEcl dlg = new GfrDlgNewSettingsTloSegWiseYesEcl(
            frmOwner,
            strsChildrenExisting);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      Point2D.Double p2dStart = null;
      Point2D.Double p2dEnd = null;
      String strDescShort = null;
      String strUrl = null;

      if (!blnCancelled)
      {
         strValue = dlg.getValueName();
         p2dStart = dlg.getGeometryPointStart();
         p2dEnd = dlg.getGeometryPointEnd();
         strDescShort = dlg.getValueTloAbstract();
         strUrl = "";//tempo
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclSegWiseYes.getInstance().newObject(
            strValue,
            strDescShort,
            strUrl,
            p2dStart,
            p2dEnd);
   }

   private void _newEditTloEclSct_(JFrame frmOwner) throws Exception
   {
      String[] strsChildrenExisting = GfrWrpBasTopSynEclScts.getInstance().getSortedNamesTlo();

      // show dialog
      GfrDlgOkNewAbs dlg = new GfrDlgNewSettingsTloUrlPnts2SctEdit(
            frmOwner, (String[]) strsChildrenExisting);

      if (!dlg.init())
      {
         String str = "! dlg.init()";
         ActPrfPrjConstructOgcEclAbs._LOGGER_.severe(str);
         throw new Exception(str);
      }

      dlg.setVisible(true);

      boolean blnCancelled = dlg.isCancelled();

      String strValue = null;
      ArrayList<Point2D.Double> dblsGeometry = null;
      String strDescShort = null;
      String strUrl = null;


      if (!blnCancelled)
      {
         strValue = dlg.getValue();
         dblsGeometry = ((GfrDlgNewSettingsTloUrlPnts2SctAbs) dlg).getGeometry();
         strDescShort = ((GfrDlgNewSettingsTlo) dlg).getValueDescShort();
         strUrl = ((GfrDlgNewSettingsTloUrlAbs) dlg).getValueUrl();
      }

      dlg.destroy();
      dlg = null;

      if (blnCancelled)
         return;

      GfrMdlDatSetTlosEclSct.getInstance().newObject(strValue, strDescShort, strUrl, dblsGeometry);
   }

   protected void _newMousePickedTloPlcEclSel(JFrame frmOwner) throws Exception
   {
      GfrFrmMainAppOgcEclAbs frm = (GfrFrmMainAppOgcEclAbs) frmOwner;

      String strStateOrbitViewSource = frm.getRestorableStateOrbitViewManage();

      if (strStateOrbitViewSource != null)
      {
         GfrSerializeStateWwdSel.s_write(strStateOrbitViewSource);
      }
   }

   protected void _newMousePickedTloPntEclSel(JFrame frmOwner) throws Exception
   {
      GfrFrmMainAppOgcEclAbs frm = (GfrFrmMainAppOgcEclAbs) frmOwner;

      String strStateOrbitViewSource = frm.getRestorableStateOrbitViewManage();

      if (strStateOrbitViewSource != null)
      {
         GfrSerializeStateWwdSel.s_write(strStateOrbitViewSource);
      }
   }

   protected void _newMousePickedTloPlcEclMan(JFrame frmOwner) throws Exception
   {
      GfrFrmMainAppOgcEclAbs frm = (GfrFrmMainAppOgcEclAbs) frmOwner;

      String strStateOrbitViewSource = frm.getRestorableStateOrbitViewManage();

      if (strStateOrbitViewSource != null)
      {
         GfrSerializeStateWwdMan.s_write(strStateOrbitViewSource);
      }
   }

   protected void _newMousePickedTloPntEclMan(JFrame frmOwner) throws Exception
   {
      GfrFrmMainAppOgcEclAbs frm = (GfrFrmMainAppOgcEclAbs) frmOwner;

      String strStateOrbitViewSource = frm.getRestorableStateOrbitViewManage();

      if (strStateOrbitViewSource != null)
      {
         GfrSerializeStateWwdMan.s_write(strStateOrbitViewSource);
      }
   }
}
TOP

Related Classes of org.geoforge.appogcecl.actionperformer.ActPrfPrjConstructOgcEclAbs

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.