コード例 #1
0
 public static VectorDataLayer createLayer(LayerContext ctx, VectorDataNode vectorDataNode) {
   final VectorDataLayerType specialLayerType =
       vectorDataNode.getExtension(VectorDataLayerType.class);
   final VectorDataLayer layer;
   if (specialLayerType != null) {
     layer = specialLayerType.createLayerInternal(ctx, vectorDataNode);
   } else {
     final VectorDataLayerType fallbackLayerType =
         LayerTypeRegistry.getLayerType(VectorDataLayerType.class);
     if (fallbackLayerType == null) {
       throw new IllegalStateException(
           "fallbackLayerType == null (missing default VectorDataLayerType)");
     }
     layer = fallbackLayerType.createLayerInternal(ctx, vectorDataNode);
   }
   return layer;
 }
コード例 #2
0
  static boolean insertImageLayer(LayerSourcePageContext pageContext) {
    AffineTransform transform =
        (AffineTransform) pageContext.getPropertyValue(PROPERTY_NAME_WORLD_TRANSFORM);
    String imageFilePath = (String) pageContext.getPropertyValue(PROPERTY_NAME_IMAGE_FILE_PATH);

    try {
      ProductSceneView sceneView = SnapApp.getDefault().getSelectedProductSceneView();
      final ImageFileLayerType type = LayerTypeRegistry.getLayerType(ImageFileLayerType.class);
      final PropertySet configuration = type.createLayerConfig(sceneView);
      configuration.setValue(ImageFileLayerType.PROPERTY_NAME_IMAGE_FILE, new File(imageFilePath));
      configuration.setValue(ImageFileLayerType.PROPERTY_NAME_WORLD_TRANSFORM, transform);
      Layer layer = type.createLayer(sceneView, configuration);
      layer.setName(FileUtils.getFileNameFromPath(imageFilePath));
      Layer rootLayer = sceneView.getRootLayer();
      rootLayer.getChildren().add(sceneView.getFirstImageLayerIndex(), layer);
      return true;
    } catch (Exception e) {
      pageContext.showErrorDialog(e.getMessage());
      return false;
    }
  }
コード例 #3
0
 public static TOPSBurstsLayer createLayer(final RasterDataNode raster) {
   final LayerType type = LayerTypeRegistry.getLayerType(TOPSBurstLayerType.class);
   final PropertySet template = type.createLayerConfig(null);
   template.setValue("raster", raster);
   return new TOPSBurstsLayer(type, template);
 }