Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.ILayer


        if (toPosition < 0 || toPosition > mapLayers.size() - 1) {
            showMessage(display,
                    Messages.getString("OperationUtils_warning"), Messages.getString("OperationUtils_nolayer"), MSGTYPE.WARNING); //$NON-NLS-1$ //$NON-NLS-2$
            return;
        }
        ILayer toLayer = mapLayers.get(toPosition);

        SimpleFeatureType toSchema = toLayer.getSchema();
        SimpleFeatureType selectedSchema = selectedLayer.getSchema();
        int compare = DataUtilities.compare(toSchema, selectedSchema);
        if (compare != 0) {
            showMessage(display,
                    Messages.getString("OperationUtils_warning"), Messages.getString("OperationUtils_sametypeproblem"), //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here


    // it,
    // and store it
    List<ILayer> mapLayers = map.getMapLayers();
    Iterator<ILayer> iterator = mapLayers.iterator();
    while (iterator.hasNext()) {
      ILayer layer = iterator.next();
      IGeoResource geoResource = layer.findGeoResource(MapMarksGraphics.class);
      if (geoResource != null) {
        MapMarksGraphics mapGraphic = geoResource.resolve(MapMarksGraphics.class, null);
        this.mapMarkGraphic = mapGraphic;
        this.mapGraphicLayer = layer;
        break;
View Full Code Here

    // remove the mapgraphic layer from the map
    List<ILayer> mapLayers = map.getMapLayers();
    Iterator<ILayer> iterator = mapLayers.iterator();
    while (iterator.hasNext()) {
      ILayer layer = iterator.next();
      IGeoResource geoResource = layer.findGeoResource(MapMarksGraphics.class);
      if (geoResource != null) {
        map.sendCommandASync(new DeleteLayerCommand((Layer) layer));
        break;
      }
    }
View Full Code Here

         * @param feature
         * @return feature label
         */
        private String getFeatureLabel(AdaptableFeature feature) {
           
            final ILayer layer = (ILayer) feature.getAdapter(ILayer.class);
            final IGeoResource resource = layer.getGeoResource();
           
            return getFeatureLabel(resource, feature);
           
        }
View Full Code Here

            return null;
        }
       
        @Override
        public Image getImage( Object element ) {
            ILayer layer = null;
            if( element instanceof AdaptableFeature){
                AdaptableFeature feature = (AdaptableFeature) element;
                layer = (ILayer) feature.getAdapter(ILayer.class);               
            }
            if( element instanceof LayerPointInfo){
                LayerPointInfo info = (LayerPointInfo) element;
                layer = info.getLayer();
            }
            if( element instanceof CoveragePointInfo){
                CoveragePointInfo info = (CoveragePointInfo) element;
                layer = info.getLayer();
            }
            String key = layer.getID().toExternalForm();               
            Image image = registry.get( key );
            if( image == null ){
                ImageDescriptor icon;
                icon = (ImageDescriptor) layer.getProperties().get("generated icon");
                if( icon == null ){
                    icon = layer.getIcon();
                }
                if( icon == null ){
                    IGeoResource resource = layer.getGeoResource();
                    try {
                        icon = resource.getInfo(null).getImageDescriptor();
                    } catch (IOException e) {
                        // not expecting this to block or throw IO as the layer was available
                        // to be hit by the info tool
View Full Code Here

     *
     * @param metrics
     * @return A rating for a given metric. The lower the rating the better fit the metric is.
     */
    private double rate( AbstractRenderMetrics metrics ) {
        ILayer layer = metrics.getRenderContext().getLayer();
        final IStyleBlackboard style = layer.getStyleBlackboard();

        // render metrics -
        // guarenteed to be between 0 & 1 - higher better so we subtract one to get make lower
        // better
        double renderAppearanceMetric = 1 - metrics.getUserAppearanceMetric(style);
View Full Code Here

*/
public class ZoomToFeatures extends AbstractActionTool {

  @Override
  public void run() {
    ILayer selectedLayer = getContext().getSelectedLayer();
    Filter selectionFilter = selectedLayer.getFilter();
    try {
      SimpleFeatureSource source = selectedLayer.getResource(SimpleFeatureSource.class, ProgressManager.instance().get());
      ReferencedEnvelope bounds = source.getFeatures(selectionFilter).getBounds();
      getContext().sendASyncCommand(new SetViewportBBoxCommand(bounds, true));
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

     * Test method for 'org.locationtech.udig.tools.edit.behaviour.ShapeCreationBehaviour.getCommand(EditToolHandler, MapMouseEvent, EventType)'
     */
    @Test
    public void testRectangleShape() throws Exception {
        final TestHandler handler=new TestHandler();
        ILayer layer = handler.getContext().getMapLayers().get(0);
        FeatureSource<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureSource.class, null);
        SimpleFeature feature = resource.getFeatures().features().next();
        ((EditManager)handler.getContext().getEditManager()).setEditFeature(feature, (Layer) layer);
       
        final EditBlackboard editBlackboard = handler.getEditBlackboard();
        PrimitiveShape shell = editBlackboard.getGeoms().get(0).getShell();
View Full Code Here

                try {
                    // Set tool mode (also set in MergeTool.setContext to MERGEMODE_TOOL)
                    MergeContext mergeContextSingleton = MergeContext.getInstance();
                    mergeContextSingleton.setMergeMode(MergeContext.MERGEMODE_OPERATION);
                    // Store eventual pre-selected features for later display in MergeView
                    ILayer preSelectedLayer = ApplicationGIS.getActiveMap().getEditManager().getSelectedLayer();
                    Filter preSelectedFilter = preSelectedLayer.getFilter();
                    if ( preSelectedFilter != Filter.EXCLUDE){
                        List<SimpleFeature> preSelectedFeatures = Util.retrieveFeatures(preSelectedFilter, preSelectedLayer);
                        mergeContextSingleton.addPreselectedFeatures(preSelectedFeatures, preSelectedLayer);
                    }
                   
View Full Code Here

    public void createControl( Composite parent ) {

        Composite mainComposite = new Composite(parent, SWT.NONE);
        mainComposite.setLayout(new GridLayout());

        ILayer selectedLayer = ApplicationGIS.getActiveMap().getEditManager().getSelectedLayer();
        geoResource = selectedLayer.getGeoResource();

        /*
         * layer selected
         */
        Label selectedLayerLabel = new Label(mainComposite, SWT.NONE);
        GridData selectedLayerLabelGd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
        selectedLayerLabelGd.horizontalSpan = 3;
        selectedLayerLabel.setLayoutData(selectedLayerLabelGd);
        selectedLayerLabel.setText(Messages.getString("KmlExportWizardPage.selectedLayerToExportLabel") + selectedLayer.getName()); //$NON-NLS-1$

        Group inputGroup = new Group(mainComposite, SWT.None);
        inputGroup.setText(Messages.getString("KmlExportWizardPage.outFileLabel")); //$NON-NLS-1$
        inputGroup.setLayout(new GridLayout(2, false));
        inputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.ILayer

Copyright © 2018 www.massapicom. 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.