Package org.geoforge.worldwind.builder.factory

Source Code of org.geoforge.worldwind.builder.factory.GfrFactoryObjPntPin

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

import gov.nasa.worldwind.WorldWindow;
import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.render.Offset;
import gov.nasa.worldwind.render.PointPlacemark;
import gov.nasa.worldwind.render.PointPlacemarkAttributes;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author robert
*/
public class GfrFactoryObjPntPin extends GfrFactoryObjPntAbs
{
   // ----
    // begin: instantiate logger for this class
    final private static Logger _LOGGER_ = Logger.getLogger(GfrFactoryObjPntPin.class.getName());

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

    // end: instantiate logger for this class
    // ----
   
   
     private static long _LNG_NEXT_ENTRY_ = 1;
   
    static private String _s_getNextName_(String base)
    {
        StringBuilder sb = new StringBuilder();
        sb.append(base);
        sb.append(GfrFactoryObjPntPin._LNG_NEXT_ENTRY_++);
        return sb.toString();
    }
   
    static private GfrFactoryObjPntPin _INSTANCE_ = null;
   
    static public GfrFactoryObjPntPin s_getInstance()
    {
        if (GfrFactoryObjPntPin._INSTANCE_ == null)
        {
            GfrFactoryObjPntPin._INSTANCE_ = new GfrFactoryObjPntPin();
           
            if (! GfrFactoryObjPntPin._INSTANCE_.init())
            {
                String str = "! GfrFactoryObjShpPlnOpn._INSTANCE_.init()";
                GfrFactoryObjPntPin._LOGGER_.severe(str);
                JOptionPane.showMessageDialog(null,
                    str, GfrResBundleLang.s_getInstance().getValue("word.error"), JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            }
        }
       
        return GfrFactoryObjPntPin._INSTANCE_;
    }
   
    static private PointPlacemarkAttributes _s_getAttributes_()
    {
       PointPlacemarkAttributes ppa = new PointPlacemarkAttributes();
      
       ppa.setScale(0.5);
       ppa.setImageOffset(new Offset(18.5d, 4d, AVKey.PIXELS, AVKey.PIXELS)); // see comment amadeus tloPushpin
      
       String strPathRelImage = "images/pushpins/plain-green.png";
       ppa.setImageAddress(strPathRelImage);

       return ppa;
    }
   
   // ---
  
   @Override
    public PointPlacemark create(WorldWindow wwd, String strNewWhatLabel)
    {
      PointPlacemark ppk = super.create(wwd, strNewWhatLabel);
     
      ppk.setValue(AVKey.DISPLAY_NAME, GfrFactoryObjPntPin._s_getNextName_(toString()));
      ppk.setAttributes(GfrFactoryObjPntPin._s_getAttributes_());
     
      return ppk;
    }
   
    @Override
    public String toString()
    {
        return "PointPushpin";
    }
   
  
   // ---
   
   private GfrFactoryObjPntPin()
   {
      super();
   }
}
TOP

Related Classes of org.geoforge.worldwind.builder.factory.GfrFactoryObjPntPin

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.