Skip to content

Commit

Permalink
Merge pull request #60 from lat-lon/feature/concatenateColors
Browse files Browse the repository at this point in the history
Added support for concatenated colors
  • Loading branch information
tfr42 authored Oct 23, 2023
2 parents e69656a + f94fd1e commit 015cf78
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
32 changes: 27 additions & 5 deletions src/main/java/org/sep3tools/PetroVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ public String visitBestandteil_fraglich(PetroGrammarParser.Bestandteil_fraglichC
}

private String getBodenTerm(String boden) {
String bodenTerm = getS3ResultSet(boden);
if (!bodenTerm.isEmpty())
return bodenTerm;
StringBuilder bodenTerm = new StringBuilder(getS3ResultSet(boden));
if (bodenTerm.length() > 0)
return bodenTerm.toString();
for (int i = 0; i <= MAX_QUANTIFIER; i++) {
if (boden.endsWith(String.valueOf(i))) {
String bodenShort = boden.substring(0, boden.length() - 1);
bodenTerm = getS3ResultSet(bodenShort);
if (!bodenTerm.isEmpty()) {
bodenTerm = new StringBuilder(getS3ResultSet(bodenShort));
if (bodenTerm.length() > 0) {
String bodenQuant = String.valueOf(i);
try {
bodenQuant = getBodenQuant(bodenShort, String.valueOf(i));
Expand All @@ -125,6 +125,28 @@ private String getBodenTerm(String boden) {
}
}
}
String forColorSeparation = boden;
int partialBodenLength = 2;
while (partialBodenLength <= forColorSeparation.length()) {
String partialTermForColor = forColorSeparation.substring(forColorSeparation.length() - partialBodenLength);
String colorPart = getS3ResultSet(partialTermForColor);
if (!colorPart.isEmpty()) {
bodenTerm.insert(0, colorPart);
if (partialTermForColor.equals(forColorSeparation)) {
return bodenTerm.toString();
}
forColorSeparation = forColorSeparation.substring(0, forColorSeparation.length() - partialBodenLength);
partialBodenLength = 1;
if (!forColorSeparation.endsWith("dd")
&& (forColorSeparation.endsWith("h") || forColorSeparation.endsWith("d"))) {
partialBodenLength = 0;
}
}
partialBodenLength++;
}
if (bodenTerm.length() > 0) {
return bodenTerm.toString();
}
switch (boden) {
case "^u":
return "Schluffstein";
Expand Down
14 changes: 9 additions & 5 deletions src/main/resources/farbetest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ ge=gelb
dgr=dunkelgrau
gn=grün
rs=rosa
ddro=sehr dunkelrot
holst=hellolivstichig
gnli=grünlich
grst=graustichig
# robn=
# blro=blaurot
# drohbngr,blro,ddro,hgrbn,mtgr,mtol,mtolst=
robn=rotbraun
blro=blaurot
mtol=mattoliv
mtolst=mattolivstichig
drohbngr,blro,ddro,hgrbn,mtgr,mtol,mtolst=dunkelrothellbraungrau, blaurot, sehr dunkelrot, hellgraubraun, mattgrau, mattoliv, mattolivstichig
dro-hgr=dunkelrot bis hellgrau
# robn,sw,ge,dgr-gn,swgerobnrs=
gnli,grst=grünlich, graustichig
robn,sw,ge,dgr-gn,swgerobnrs=rotbraun, schwarz, gelb, dunkelgrau bis grün, schwarzgelbrotbraunrosa
gnli,grst=grünlich, graustichig

0 comments on commit 015cf78

Please sign in to comment.