Package org.locationtech.udig.project.internal

Examples of org.locationtech.udig.project.internal.Layer


     * @see
     * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
     */
    @Override
    protected Control createContents( Composite parent ) {
        Layer layer = getElement( Layer.class );
       
        SimpleFeatureType schema = layer.getSchema();
        // check if layer is polygon
        if (schema == null) {
            // disable!
        }
        Composite page = new Composite(parent, SWT.NONE);
View Full Code Here


     * (as the default is to include all content).
     *
     * @return Filter, or {@link Filter#INCLUDE} if not available
     */
    Filter getDataQueryFilter(){
        Layer layer = getElement(Layer.class);
        if( layer != null ){
            StyleBlackboard blackboard = layer.getStyleBlackboard();
            Object dataQuery = blackboard.get( ProjectBlackboardConstants.LAYER__DATA_QUERY );
            if( dataQuery instanceof Filter ){
                return (Filter) dataQuery;
            }
            if( dataQuery instanceof Query){
View Full Code Here

     */
    private void saveLayer() {
        Filter stored = getDataQueryFilter();
        Filter current = filter.getFilter();
        if(!IFilterViewer.same(stored,  current)){
            Layer layer = getElement(Layer.class);
            if( layer != null ){
                StyleBlackboard blackboard = layer.getStyleBlackboard();
                blackboard.put(ProjectBlackboardConstants.LAYER__DATA_QUERY, current );
                layer.refresh(null); // force redraw?
            }
        }
    }
View Full Code Here

        }
    }
   
    /* Grabs the layer and fills in the current page. */
    private void loadLayer() {
        Layer layer = getElement(Layer.class);
        SimpleFeatureType schema = layer != null ? layer.getSchema() : null;
        filter.getInput().setSchema(schema);
       
        boolean enabled = schema != null;
        filter.getControl().setEnabled(enabled);
       
View Full Code Here

   * Test method for 'org.locationtech.udig.project.ui.FeatureIssue.fixIssue(IViewPart, IEditorPart)'
   */
  @Ignore
  @Test
  public void testFixIssue() throws Exception {
    final Layer layer= map.getLayersInternal().get(0);
    layer.setCRS(DefaultGeographicCRS.WGS84);
    CoordinateReferenceSystem crs = CRS.decode("EPSG:3005");//$NON-NLS-1$
    map.getViewportModelInternal().setCRS(crs);
    FeatureIssue issue=new FeatureIssue(Priority.LOW, "Description",layer, features[0], "test" ); //$NON-NLS-1$ //$NON-NLS-2$
   
    if( issue.getViewPartId()!=null  ){
      IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      IViewPart view = activePage.findView(issue.getViewPartId());
      activePage.hideView(view);
    }
   
    assertFalse(ApplicationGIS.getActiveMap()==map);
   

        IssueHandler handler = IssueHandler.createHandler(issue);
       
        handler.fixIssue();
        map.sendCommandSync(new BlankCommand());
        UDIGTestUtil.inDisplayThreadWait(10000,new WaitCondition(){

      public boolean isTrue()  { 
                try{

                    ReferencedEnvelope env = new ReferencedEnvelope(features[0].getBounds());
                    Envelope transformed = (Envelope)env.transform(layer.getCRS(), true,5);
        return features[0].equals(map.getEditManager().getEditFeature()) &&
        map.getViewportModel().getBounds().contains(transformed);
                }catch (Exception e) {
                    throw (RuntimeException)new RuntimeException().initCause(e);
                }
      }
         
        }, true);
        assertTrue(layer.getFilter() instanceof Id);
        assertEquals(features[0].getID(), ((Id)layer.getFilter()).getIDs().toArray(new String[0])[0]);
        assertEquals(features[0], map.getEditManager().getEditFeature());
        assertEquals("active map should be the map of the issue", map, ApplicationGIS.getActiveMap()); //$NON-NLS-1$
        ReferencedEnvelope env = new ReferencedEnvelope(features[0].getBounds());
        assertTrue("Map must contain feature", map.getViewportModel().getBounds().contains((Envelope)env.transform(layer.getCRS(), true,5))); //$NON-NLS-1$
  }
View Full Code Here

                    }
                }
            }
            if (legendResource == null)
                return;
            Layer layer = map.getLayerFactory().createLayer(legendResource);
            map.sendCommandSync(BasicCommandFactory.getInstance().createAddLayer(layer));
        } catch (MalformedURLException e) {
            MapGraphicPlugin.log("", e); //$NON-NLS-1$
        } catch (IOException e) {
            MapGraphicPlugin.log("", e); //$NON-NLS-1$
View Full Code Here

    public void addDeepAdapter( Adapter adapter ) {
        deepAdapters.add(adapter);
        if (!owner.eAdapters().contains(adapter))
            owner.eAdapters().add(adapter);
        for( Object object : this ) {
            Layer layer = (Layer) object;
            if (!layer.eAdapters().contains(adapter))
                layer.eAdapters().add(adapter);
        }
    }
View Full Code Here

        if (ProjectPlugin.isDebugging(Trace.MODEL))
            ProjectPlugin
                    .trace(
                            getClass(),
                            "Adding " + ((Layer) object).getID() + " to map " + getMap().getName() + " at location: " + index, null); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
        Layer object2 = super.assign(index, object);
        if (ProjectPlugin.isDebugging(Trace.MODEL))
            ProjectPlugin.trace(getClass(), "Resulting list=" + this, null); //$NON-NLS-1$

        return object2;
    }
View Full Code Here

     *      java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
     */
    public void op( final Display display, Object target, IProgressMonitor monitor )
            throws Exception {
       
        final Layer layer = (Layer) target;
        final CoordinateReferenceSystem layerCRS = layer.getCRS();
        final Envelope bounds = layer.getBounds(monitor, layerCRS);
       
        final List<SummaryData> data=new ArrayList<SummaryData>();
       
        data.add(new SummaryData(Messages.LayerSummary_name, layer.getName()));
        data.add(new SummaryData(Messages.LayerSummary_id,layer.getID()));
        data.add(new SummaryData(Messages.LayerSummary_zorder,layer.getZorder()));
        data.add(new SummaryData(Messages.LayerSummary_crs,layerCRS.getName()));
        data.add(new SummaryData(Messages.LayerSummary_bounds, parseBounds(bounds)));
        data.add(new SummaryData(Messages.LayerSummary_selection,layer.getFilter()));

        display.asyncExec(new Runnable(){
            public void run() {
                SummaryDialog d=new SummaryDialog( display.getActiveShell(), Messages.LayerSummary_title
                        + layer.getName(), data );
               
                d.setBlockOnOpen(true);
                d.open();
            }
        });
View Full Code Here

        super.doClear();
    }

    private void removeAllInterceptors( Collection<?> c ) {
        for( Iterator<?> iter = c.iterator(); iter.hasNext(); ) {
            Layer element = (Layer) iter.next();
            runLayerInterceptor(element, "layerRemoved"); //$NON-NLS-1$
            element.eAdapters().removeAll(deepAdapters);
        }
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.Layer

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.