From 28e6a4d4da0bd207b56150134d8cd9d497a74a23 Mon Sep 17 00:00:00 2001 From: Ermis Ioannis Michail Delopoulos <100307220+ermismd@users.noreply.github.com> Date: Sun, 3 Sep 2023 00:05:48 +0200 Subject: [PATCH] Update anotherpage4.md --- anotherpage4.md | 76 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/anotherpage4.md b/anotherpage4.md index 732a983..f8b38a8 100644 --- a/anotherpage4.md +++ b/anotherpage4.md @@ -297,39 +297,39 @@ style.setDefaultValue(BasicVisualLexicon.NODE_BORDER_PAINT, Color.DARK_GRAY); // VisualProperty for node shape - VisualProperty nodeShapeVP = BasicVisualLexicon.NODE_SHAPE; - - // Create a discrete mapping function for node shape - DiscreteMapping shapeMapping = (DiscreteMapping) discreteMappingFactory - .createVisualMappingFunction(columnName, String.class, nodeShapeVP); - - // Map taxonomy-level to shapes - Map taxonomyShapeMap = getTaxonomyShapeMap(); - - // Set taxonomy-level to shape pairs - for (Map.Entry entry : taxonomyShapeMap.entrySet()) { - shapeMapping.putMapValue(entry.getKey(), entry.getValue()); - } + VisualProperty<NodeShape> nodeShapeVP = BasicVisualLexicon.NODE_SHAPE; + + // Create a discrete mapping function for node shape + DiscreteMapping<String, NodeShape> shapeMapping = (DiscreteMapping<String, NodeShape>) discreteMappingFactory + .createVisualMappingFunction(columnName, String.class, nodeShapeVP); + + // Map taxonomy-level to shapes + Map<String, NodeShape> taxonomyShapeMap = getTaxonomyShapeMap(); + + // Set taxonomy-level to shape pairs + for (Map.Entry<String, NodeShape> entry : taxonomyShapeMap.entrySet()) { + shapeMapping.putMapValue(entry.getKey(), entry.getValue()); + } // Add mapping function to the visual style style.addVisualMappingFunction(shapeMapping); // Node Labels style.setDefaultValue(BasicVisualLexicon.NODE_LABEL, ""); - PassthroughMapping labelMapping = (PassthroughMapping) vmfFactoryP - .createVisualMappingFunction("name", String.class, BasicVisualLexicon.NODE_LABEL); + PassthroughMapping<String, String> labelMapping = (PassthroughMapping<String, String>) vmfFactoryP + .createVisualMappingFunction("name", String.class, BasicVisualLexicon.NODE_LABEL); style.addVisualMappingFunction(labelMapping); - - // discrete mapping function - DiscreteMapping mapping = (DiscreteMapping) discreteMappingFactory - .createVisualMappingFunction(columnName, String.class, vp); - - // map species to colors - Map speciesColorMap = getSpeciesColorMap(); - + + // Discrete mapping function + DiscreteMapping<String, Paint> mapping = (DiscreteMapping<String, Paint>) discreteMappingFactory + .createVisualMappingFunction(columnName, String.class, vp); + + // Map species to colors + Map<String, Paint> speciesColorMap = getSpeciesColorMap(); + // Set the species-color pairs - for (Map.Entry entry : speciesColorMap.entrySet()) { - mapping.putMapValue(entry.getKey(), entry.getValue()); + for (Map.Entry<String, Paint> entry : speciesColorMap.entrySet()) { + mapping.putMapValue(entry.getKey(), entry.getValue()); } // Add the mapping function to the visual style @@ -375,20 +375,20 @@ - private Map getTaxonomyShapeMap() { - Map taxonomyShapeMap = new HashMap<>(); - taxonomyShapeMap.put("genus", NodeShapeVisualProperty.DIAMOND); - taxonomyShapeMap.put("family", NodeShapeVisualProperty.ROUND_RECTANGLE); - taxonomyShapeMap.put("mspecies", NodeShapeVisualProperty.ELLIPSE); - taxonomyShapeMap.put("null", NodeShapeVisualProperty.OCTAGON); - taxonomyShapeMap.put("species", NodeShapeVisualProperty.HEXAGON); - // Add more taxonomy-level to shape mappings as needed - return taxonomyShapeMap; + private Map<String, NodeShape> getTaxonomyShapeMap() { + Map<String, NodeShape> taxonomyShapeMap = new HashMap<>(); + taxonomyShapeMap.put("genus", NodeShapeVisualProperty.DIAMOND); + taxonomyShapeMap.put("family", NodeShapeVisualProperty.ROUND_RECTANGLE); + taxonomyShapeMap.put("mspecies", NodeShapeVisualProperty.ELLIPSE); + taxonomyShapeMap.put("null", NodeShapeVisualProperty.OCTAGON); + taxonomyShapeMap.put("species", NodeShapeVisualProperty.HEXAGON); + // Add more taxonomy-level to shape mappings as needed + return taxonomyShapeMap; + } + + private Map<String, Paint> getSpeciesColorMap() { + Map<String, Paint> speciesColorMap = new HashMap<>(); } - - private Map getSpeciesColorMap() { - - Map speciesColorMap = new HashMap<>(); PaletteProvider colorBrewerPaletteProvider = paletteManager.getPaletteProvider("ColorBrewer"); Palette set1 = colorBrewerPaletteProvider.getPalette("Set1 colors");