Skip to content

Commit 2034f87

Browse files
committed
Fix config and usage for plant
1 parent 8ee1674 commit 2034f87

7 files changed

Lines changed: 26 additions & 24 deletions

File tree

generator/org.svis.generator.releng/settings.properties

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ plant.junction.distance_multiplier = 8.0
224224
plant.junction.pollstem.ball_multiplier = 0.10
225225

226226
# Stuff from city for the layout algorithm
227-
# Das eventuell weglassen und die Werte von City nehmen?
228-
# Allerdings stehen teilweise etwas andere Werte drin als bei city
229227
plant.width_min = 1.0
230228
plant.height_min = 1.0
231229
plant.building.horizontal_margin = 3.0
@@ -234,7 +232,7 @@ plant.building.vertical_margin = 1.0
234232

235233
# Possible values are default (default) and cylinder
236234
plant.package.shape = default
237-
plant.package.use_textures = false
235+
plant.package.use_textures = true
238236
plant.package.odd_texture = <ImageTexture url='pics/ground.png' scale='false' />
239237
plant.package.even_texture = <ImageTexture url='pics/freeGrass.png' scale='false' />
240238
plant.package.odd_color = #964327
@@ -279,8 +277,8 @@ plant.method.show = true
279277
plant.method.use_textures = true
280278
plant.method.texture = <ImageTexture url='pics/junctionGreen.png' scale='false' />
281279
plant.method.texture_pollball = <ImageTexture url='pics/pollball.png' scale='false' />
282-
plant.method.color = #000100
283-
plant.method.color02 = #010100
280+
plant.method.color = #00FF00
281+
plant.method.color02 = #FFFF00
284282

285283
# Possible values are default (default), stick, sphere, pollpetal
286284
plant.inner_class_method.shape = default

generator/org.svis.generator.run/src/org/svis/generator/run/plant/Famix2Plant.mwe2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var outputPath = "./output/plant/famix"
66
//var runtimeProject = "../${projectName}"
77
var texturSourcePath = "org.svis.generator/src/org/svis/generator/plant/m2t/textures"
88
var texturDestinyPath = "org.svis.generator.run/output/plant/famix/pics"
9-
var configPath = "./input/famix/plantConfig.json"
9+
//var configPath = "./input/famix/plantConfig.json"
1010

1111
Workflow {
1212

@@ -36,7 +36,7 @@ Workflow {
3636
// transform famix into disks (s2m)
3737
component = org.svis.generator.plant.s2m.Famix2Plant {
3838
modelSlot = "famix"
39-
config = configPath
39+
// config = configPath
4040
}
4141

4242
// write metaData
@@ -57,7 +57,7 @@ Workflow {
5757
// calculate layout (m2m)
5858
component = org.svis.generator.plant.m2m.Plant2Plant {
5959
modelSlot = "plant"
60-
config = configPath
60+
// config = configPath
6161
}
6262

6363
component = org.eclipse.emf.mwe.utils.Writer {

generator/org.svis.generator/src/org/svis/generator/SettingsConfiguration.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,15 +604,15 @@ public String getPackageShape() {
604604
}
605605

606606
public boolean isPackageUseTextures() {
607-
return config.getBoolean("plant.package.use_textures", false);
607+
return config.getBoolean("plant.package.use_textures", true);
608608
}
609609

610610
public String getPackageOddTexture() {
611-
return config.getString("plant.package.odd_texture");
611+
return config.getString("plant.package.odd_texture", "<ImageTexture url='pics/ground.png' scale='false' />");
612612
}
613613

614614
public String getPackageEvenTexture() {
615-
return config.getString("plant.package.even_texture");
615+
return config.getString("plant.package.even_texture", "<ImageTexture url='pics/freeGrass.png' scale='false' />");
616616
}
617617

618618
public String getPackageOddColor() {
@@ -768,12 +768,12 @@ public String getMethodTexturePollball() {
768768
}
769769

770770
public String getMethodColor() {
771-
Color color = getColor(config.getString("plant.method.color", "#000100"));
771+
Color color = getColor(config.getString("plant.method.color", "#00FF00"));
772772
return getPlantColorFormatted(getColorFormatted(color));
773773
}
774774

775775
public String getMethodColor02() {
776-
Color color = getColor(config.getString("plant.method.color", "#010100"));
776+
Color color = getColor(config.getString("plant.method.color", "#FFFF00"));
777777
return getPlantColorFormatted(getColorFormatted(color));
778778
}
779779

@@ -833,7 +833,7 @@ public double getPollstemBallMultiplier() {
833833
}
834834

835835
public double getPollstemBallHeight() {
836-
return getCronHeight() + 3.78;
836+
return getCronHeight() + 3.87;
837837
}
838838

839839
public double getJunctionAngle() {
@@ -861,7 +861,7 @@ public double getPlantBuildingHorizontalGap() {
861861
}
862862

863863
public double getPlantBuildingVerticalMargin() {
864-
return config.getDouble("plant.building.vertical_margin", 3.0);
864+
return config.getDouble("plant.building.vertical_margin", 1.0);
865865
}
866866

867867
private String getColorFormatted(Color color) {

generator/org.svis.generator/src/org/svis/generator/plant/m2m/Plant2Plant.xtend

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import org.svis.xtext.plant.PollStem
1414
import org.svis.generator.plant.WorkflowComponentWithPlantConfig
1515
import org.svis.xtext.plant.Junction
1616
import org.svis.generator.SettingsConfiguration
17+
import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot
18+
import org.apache.commons.logging.LogFactory
1719

18-
class Plant2Plant extends WorkflowComponentWithPlantConfig {
20+
class Plant2Plant extends WorkflowComponentWithModelSlot {
1921

2022
val config = SettingsConfiguration.instance
2123

22-
// val log = LogFactory::getLog(class)
24+
val log = LogFactory::getLog(class)
2325
// TODO solve it with injection
2426
// @Inject extension FamixUtils
2527
// extension FamixUtils util = new FamixUtils
@@ -181,7 +183,7 @@ class Plant2Plant extends WorkflowComponentWithPlantConfig {
181183
* Calculate and set stem size.
182184
*/
183185
def private void calcStemSize(Stem stem) {
184-
if (config.classSize == "Count_AttributesAndMethods") {
186+
if (config.classSize == "count_attributes_and_methods") {
185187
stem.width = config.stemThickness * 2 + stem.dataCounter + stem.methodCounter + config.stemHeight * 2 + 6;
186188
stem.length = config.stemThickness * 2 + stem.dataCounter + stem.methodCounter + config.stemHeight * 2 + 6;
187189
stem.height = config.stemHeight + stem.dataCounter + stem.methodCounter + stem.methodCounter;

generator/org.svis.generator/src/org/svis/generator/plant/m2t/Plant2X3D.xtend

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import org.svis.generator.plant.WorkflowComponentWithPlantConfig
1919
import org.eclipse.emf.mwe.core.WorkflowContext
2020
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor
2121
import org.eclipse.emf.mwe.core.issues.Issues
22+
import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot
2223

23-
class Plant2X3D extends WorkflowComponentWithPlantConfig implements IGenerator2 {
24+
class Plant2X3D extends WorkflowComponentWithModelSlot implements IGenerator2 {
2425

2526

2627
@Inject extension X3DUtils util
@@ -32,7 +33,7 @@ class Plant2X3D extends WorkflowComponentWithPlantConfig implements IGenerator2
3233

3334
override afterGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext ig) {
3435
log.info("Plant2X3D has finished.")
35-
config.toJSON(config.outputDirectory + "/plantConfig.json");
36+
// config.toJSON(config.outputDirectory + "/plantConfig.json");
3637
}
3738

3839

generator/org.svis.generator/src/org/svis/generator/plant/m2t/PlantShapePetal.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PlantShapePetal {
1010

1111
public final String DEFAULT = "DEFAULT";
1212
public final String DEFAULT_WITH_CYLINDER = "DEFAULT_WITH_CYLINDER";
13-
public final String REALITIC_PETAL = "REALITIC_PETAL";
13+
public final String REALITIC_PETAL = "REALISTIC_PETAL";
1414

1515
/**
1616
* Get shape string for shapeID.

generator/org.svis.generator/src/org/svis/generator/plant/s2m/Famix2Plant.xtend

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import org.svis.xtext.famix.impl.FAMIXMethodImpl
2323
import org.svis.generator.plant.WorkflowComponentWithPlantConfig
2424
import org.svis.xtext.plant.Junction
2525
import org.svis.generator.SettingsConfiguration
26+
import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot
2627

27-
class Famix2Plant extends WorkflowComponentWithPlantConfig {
28+
class Famix2Plant extends WorkflowComponentWithModelSlot {
2829
val config = SettingsConfiguration.instance
2930
val log = LogFactory::getLog(class)
3031
val static plantFactory = new PlantFactoryImpl()
@@ -120,7 +121,7 @@ class Famix2Plant extends WorkflowComponentWithPlantConfig {
120121
methods.filter[parentType.ref === el].forEach[entity.methodCounter = entity.methodCounter + 1]
121122

122123
// mapping attribute and methods to PETAL || POLLSTEM:
123-
if (config.switchAttributeMethodMapping === "PETAL_POLLSTEM") {
124+
if (config.switchAttributeMethodMapping == "PETAL_POLLSTEM") {
124125
if (config.showAttributes) {
125126
attributes.filter[parentType.ref === el].forEach[entity.petals += toPetals(entity)]
126127
}
@@ -260,7 +261,7 @@ class Famix2Plant extends WorkflowComponentWithPlantConfig {
260261
attributes.filter[parentType.ref === el].forEach[junction.dataCounter = junction.dataCounter + 1]
261262
methods.filter[parentType.ref === el].forEach[junction.methodCounter = junction.methodCounter + 1]
262263

263-
if (config.switchAttributeMethodMapping === "PETAL_POLLSTEM") {
264+
if (config.switchAttributeMethodMapping == "PETAL_POLLSTEM") {
264265
if (config.showAttributes) {
265266
attributes.filter[parentType.ref === el].forEach[junction.petals += toPetals(junction)]
266267
}

0 commit comments

Comments
 (0)