Package org.geoforge.appogcecl.actioncontroller

Source Code of org.geoforge.appogcecl.actioncontroller.GfrAcrSpcAppPrsPrjSelOgcEclAbs

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

import gov.nasa.worldwind.geom.LatLon;
import gov.nasa.worldwind.geom.Position;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import org.geoforge.appogcecl.actionmanager.GfrAmrAppPrsSelAbs;
import org.geoforge.guillc.GfrAppSpcAbs;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillcogcecl.dialog.GfrDlgCmdCancelBldObjWwdEarthAbs;
import org.geoforge.guillcogcecl.frame.GfrFrmMainAppOgcEclAbs;
import org.geoforge.io.serial.GfrSerializeStateWwdSel;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.mdldsp.state.singleton.selecttlo.GfrMdlSttSngSelTlo;
import org.geoforge.wrpbasprsdsp.state.singleton.selecttlo.GfrWrpObjSttSngSelTlo;
import org.geoforge.wrpbasprssynecl.*;

/**
*
* @author robert
*/
abstract public class GfrAcrSpcAppPrsPrjSelOgcEclAbs extends GfrAcrSpcAppPrsPrjSelAbs
{

   final static protected String _STR_TITLE_DIALOG_BUILDER_SECTOR = "Select top-objects by mouse-dragging sector";

   // ----
   // begin: instantiate logger for this class
   final private static Logger _LOGGER_ = Logger.getLogger(GfrAcrSpcAppPrsPrjSelOgcEclAbs.class.getName());

   static
   {
      GfrAcrSpcAppPrsPrjSelOgcEclAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }

   // ---
   // ######################################################################
   // ---
   // tempo location and tempo code
   static protected boolean _s_sectorContainsPosition(LatLon llnMin, LatLon llnMax, Position posCandidate)
   {
      double dblLatCandidate = posCandidate.latitude.degrees;
      double dblLonCandidate = posCandidate.longitude.degrees;

      if (dblLatCandidate < llnMin.latitude.degrees)
         return false;

      if (dblLonCandidate < llnMin.longitude.degrees)
         return false;

      if (dblLatCandidate > llnMax.latitude.degrees)
         return false;

      if (dblLonCandidate > llnMax.longitude.degrees)
         return false;

      return true;
   }

   // if at least one position inside sedctor, then returns true
   static public boolean _s_sectorContainsPosition(LatLon llnMin, LatLon llnMax, List<Position> lstPosCandidate)
   {
      for (Position posCurCandidate : lstPosCandidate)
      {
         if (_s_sectorContainsPosition(llnMin, llnMax, posCurCandidate))
            return true;
      }

      return false;
   }

   // end: instantiate logger for this class
   // ----
  
   abstract protected GfrDlgCmdCancelBldObjWwdEarthAbs _createBuilderSection() throws Exception;

   protected GfrAcrSpcAppPrsPrjSelOgcEclAbs(GfrAppSpcAbs app, GfrAmrAppPrsSelAbs amr) throws Exception
   {
      super(app, amr);
   }

   /*
    * comes from project's controller
    */
   @Override
   public void selectAllTlosWithGeomButOgcsBySectorHandler() throws Exception
   {
      GfrFrmMainAppOgcEclAbs frm = (GfrFrmMainAppOgcEclAbs) super._app.getFrame();

      String strStateOrbitViewSource = frm.getRestorableStateOrbitViewSelect();

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

      GfrDlgCmdCancelBldObjWwdEarthAbs dlg = _createBuilderSection();

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

      dlg.setVisible(true);
      boolean blnCancelledPicks = dlg.isCancelled();
      ArrayList<LatLon> alt = null;

      if (!blnCancelledPicks)
         alt = (ArrayList<LatLon>) dlg.getValue();



      if (blnCancelledPicks)
      {
         dlg.destroy();
         dlg = null;
         return;
      }

      // ---
      //
      String[] strsChoice =
      {
         "Check all inside sector",
         "Uncheck all inside sector",
         "Only check all inside sector",
         "Only check all outside sector"
      };

      final String objBodyMessage = "Filtering top-objects by using sector,\n please choose from list below:\n\n";
      final String strTitleMessage = "Select top-objects - Step 2/2";

      Object objValueInitial = strsChoice[0];

      Object objResult = JOptionPane.showInputDialog(
            null, objBodyMessage, strTitleMessage,
            JOptionPane.QUESTION_MESSAGE, (Icon) null, strsChoice, objValueInitial);

      // ---
      dlg.destroy();
      dlg = null;

      if (objResult == null)
         return; // action cancelled

      boolean bln = false;

      if (objResult == strsChoice[0])
         bln = _checkAllInside(alt);
      else if (objResult == strsChoice[1])
         bln = _uncheckAllInside(alt);
      else if (objResult == strsChoice[2])
         bln = _onlyCheckAllInside(alt);
      else
         bln = _onlyCheckAllOutside(alt);

      if (!bln)
      {
         // no actions done
         // message could be specialized depending on user's choice
         GfrOptionPaneAbs.s_showDialogInfo(frm, "No action done by using this sector");
      }
   }

   // ---
   protected boolean _uncheckAllInside(ArrayList<LatLon> alt)
   {
      boolean bln = false;

      try
      {
         bln |= _uncheckAllSectorsInside_(alt);
         bln |= _uncheckAllAreasInside_(alt);
         bln |= _uncheckAllPathsInside_(alt);
         bln |= _uncheckAllWiseSegmentsInside_(alt);
         bln |= _uncheckAllPointsInside_(alt);
         bln |= _uncheckAllPlacemarksInside_(alt);
         bln |= _uncheckAllPointsetsInside_(alt);
      }
      catch (Exception exc)
      {
         exc.printStackTrace();
         String strError = exc.getMessage();
         GfrAcrSpcAppPrsPrjSelOgcEclAbs._LOGGER_.info(strError);
         GfrOptionPaneAbs.s_showDialogInfo(super._app.getFrame(), strError);
      }

      return bln;
   }

   protected boolean _checkAllInside(ArrayList<LatLon> alt)
   {
      boolean bln = false;

      try
      {
         bln |= _checkAllSectorsInside_(alt);
         bln |= _checkAllAreasInside_(alt);
         bln |= _checkAllPathsInside_(alt);
         bln |= _checkAllWiseSegmentsInside_(alt);
         bln |= _checkAllPointsInside_(alt);
         bln |= _checkAllPlacemarksInside_(alt);
         bln |= _checkAllPointsetsInside_(alt);
      }
      catch (Exception exc)
      {
         exc.printStackTrace();
         String strError = exc.getMessage();
         GfrAcrSpcAppPrsPrjSelOgcEclAbs._LOGGER_.info(strError);
         GfrOptionPaneAbs.s_showDialogInfo(super._app.getFrame(), strError);
      }

      return bln;
   }

   protected boolean _onlyCheckAllInside(ArrayList<LatLon> alt)
   {
      boolean bln = false;

      try
      {
         bln |= _onlyCheckAllSectorsInside_(alt);
         bln |= _onlyCheckAllAreasInside_(alt);
         bln |= _onlyCheckAllPathsInside_(alt);
         bln |= _onlyCheckAllWiseSegmentsInside_(alt);
         bln |= _onlyCheckAllPointsInside_(alt);
         bln |= _onlyCheckAllPlacemarksInside_(alt);
         bln |= _onlyCheckAllPointsetsInside_(alt);
      }
      catch (Exception exc)
      {
         exc.printStackTrace();
         String strError = exc.getMessage();
         GfrAcrSpcAppPrsPrjSelOgcEclAbs._LOGGER_.info(strError);
         GfrOptionPaneAbs.s_showDialogInfo(super._app.getFrame(), strError);
      }

      return bln;
   }

   protected boolean _onlyCheckAllOutside(ArrayList<LatLon> alt)
   {
      boolean bln = false;

      try
      {
         bln |= _onlyCheckAllSectorsOutside_(alt);
         bln |= _onlyCheckAllAreasOutside_(alt);
         bln |= _onlyCheckAllPathsOutside_(alt);
         bln |= _onlyCheckAllWiseSegmentsOutside_(alt);
         bln |= _onlyCheckAllPointsOutside_(alt);
         bln |= _onlyCheckAllPlacemarksOutside_(alt);
         bln |= _onlyCheckAllPointsetsOutside_(alt);
      }
      catch (Exception exc)
      {
         exc.printStackTrace();
         String strError = exc.getMessage();
         GfrAcrSpcAppPrsPrjSelOgcEclAbs._LOGGER_.info(strError);
         GfrOptionPaneAbs.s_showDialogInfo(super._app.getFrame(), strError);
      }

      return bln;
   }

   // ---
   // ###
   // beg Plcs
   private boolean _checkAllPlacemarksInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPlcs.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;


      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         Position posCur = GfrWrpBasSynObjNameTloEclPlc.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPlacemarksInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPlcs.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         Position posCur = GfrWrpBasSynObjNameTloEclPlc.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPlacemarksOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPlcs.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         Position posCur = GfrWrpBasSynObjNameTloEclPlc.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllPlacemarksInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclPlcs.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;


      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         Position posCur = GfrWrpBasSynObjNameTloEclPlc.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Plcs

   // beg Pnts
   private boolean _checkAllPointsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;


      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         Position posCur = GfrWrpBasSynObjNameTloEclPnt.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPointsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         Position posCur = GfrWrpBasSynObjNameTloEclPnt.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPointsOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         Position posCur = GfrWrpBasSynObjNameTloEclPnt.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllPointsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclPnts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;


      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         Position posCur = GfrWrpBasSynObjNameTloEclPnt.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, posCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Pnts

   // beg Scts
   private boolean _checkAllSectorsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclScts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSct.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllSectorsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclScts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSct.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllSectorsOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclScts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSct.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllSectorsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclScts.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSct.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Scts

   // beg Ares
   private boolean _checkAllAreasInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclAres.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclAre.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllAreasInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclAres.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclAre.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllAreasOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclAres.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclAre.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllAreasInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclAres.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclAre.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Ares

   // beg Pths
   private boolean _checkAllPathsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPths.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclPth.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPathsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPths.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclPth.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPathsOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclPths.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclPth.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllPathsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclPths.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclPth.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Pths

   // beg WisSegs
   private boolean _checkAllWiseSegmentsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().getPositions(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllWiseSegmentsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().getPositions(strIdCur);


         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllWiseSegmentsOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().getPositions(strIdCur);


         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllWiseSegmentsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclSegsWiseYes.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSegWiseYes.getInstance().getPositions(strIdCur);


         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end WisSegs

   /*
    * for now, if at least one segment intersects sector (meaning at least one point insde sector,
    * then considered as being inside
    */
   // beg Spns
   private boolean _checkAllPointsetsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSpns.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSpn.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPointsetsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSpns.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSpn.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
            bln |= true;
            continue;
         }

         // else ...
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }

   private boolean _onlyCheckAllPointsetsOutside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;

      String[] strsIdTloAll = GfrWrpBasTopSynEclSpns.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSpn.getInstance().getGeometry(strIdCur);

         if (GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
         {
            if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
               continue;

            // ---
            GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
            bln |= true;
            continue;
         }

         // else ...
         if (GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         // ---
         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, true);
         bln |= true;
      }

      return bln;
   }

   private boolean _uncheckAllPointsetsInside_(ArrayList<LatLon> alt) throws Exception
   {
      boolean bln = false;
      String[] strsIdTloAll = GfrWrpBasTopSynEclSpns.getInstance().getIdsTlo();

      if (strsIdTloAll == null || strsIdTloAll.length < 1)
         return bln;

      LatLon llnMin = alt.get(0);
      LatLon llnMax = alt.get(1);

      for (String strIdCur : strsIdTloAll)
      {
         if (!GfrWrpObjSttSngSelTlo.getInstance().isEnabled(strIdCur))
            continue;

         List<Position> lstPosCur = GfrWrpBasSynObjNameTloEclSpn.getInstance().getGeometry(strIdCur);

         if (!GfrAcrSpcAppPrsPrjSelOgcEclAbs._s_sectorContainsPosition(llnMin, llnMax, lstPosCur))
            continue;


         GfrMdlSttSngSelTlo.getInstance().doJob(strIdCur, false);
         bln |= true;
      }

      return bln;
   }
   // end Spns
}
TOP

Related Classes of org.geoforge.appogcecl.actioncontroller.GfrAcrSpcAppPrsPrjSelOgcEclAbs

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.