Skip to content

Commit

Permalink
KOST-Simy v0.0.5
Browse files Browse the repository at this point in the history
================
Bessere Beschreibung der Toleranz im config
Toleranz (N, S, M, L, XL)in gorss oder Kleinscheibung möglich

TODO:
Englisch und Französisch
  • Loading branch information
Chlara committed Sep 24, 2015
1 parent a4e6e53 commit d3b54be
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 22 deletions.
Expand Up @@ -77,22 +77,26 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
return false;
}

if ( imToleranceTxt.equalsIgnoreCase( "N" ) ) {
if ( imToleranceTxt.contains( "N" ) || imToleranceTxt.contains( "n" ) ) {
// null = 0%
imTolerance = "0%";
percentageInvalid = (float) 100.000000000;
} else if ( imToleranceTxt.equalsIgnoreCase( "S" ) ) {
imToleranceTxt = "N";
} else if ( imToleranceTxt.contains( "S" ) || imToleranceTxt.contains( "s" ) ) {
// small = 2%
imTolerance = "2%";
percentageInvalid = (float) 99.9999;
} else if ( imToleranceTxt.equalsIgnoreCase( "L" ) ) {
imToleranceTxt = "S";
} else if ( imToleranceTxt.contains( "L" ) || imToleranceTxt.contains( "L" ) ) {
// large = 10%
imTolerance = "10%";
percentageInvalid = (float) 99.99;
} else if ( imToleranceTxt.equalsIgnoreCase( "XL" ) ) {
imToleranceTxt = "L";
} else if ( imToleranceTxt.contains( "XL" ) || imToleranceTxt.contains( "xl" ) ) {
// xlarge = 15%
imTolerance = "15%";
percentageInvalid = (float) 99.9;
imToleranceTxt = "XL";
} else {
// medium = 5%
imTolerance = "5%";
Expand All @@ -118,10 +122,10 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
/* compare -fuzz 15% -metric AE -quiet -identify -verbose -highlight-color DarkRed Image_1.jpg
* Image_2.jpg mask.jpg >>results_id.txt 2>results.txt */

String command = "cmd /c \"" + pathToCompareExe + " -fuzz " + imTolerance
String command = "cmd /c \"\"" + pathToCompareExe + "\" -fuzz " + imTolerance
+ " -metric AE -quiet -identify -verbose -highlight-color DarkRed \""
+ origDatei.getAbsolutePath() + "\" " + "\"" + repDatei.getAbsolutePath() + "\" \""
+ pathToMask + "\" >>" + pathToOutputId + " 2>" + pathToOutput + "\"";
+ origDatei.getAbsolutePath() + "\" \"" + repDatei.getAbsolutePath() + "\" \""
+ pathToMask + "\" >>\"" + pathToOutputId + "\" 2>\"" + pathToOutput + "\"";
/* Das redirect Zeichen verunmöglicht eine direkte eingabe. mit dem geschachtellten Befehl
* gehts: cmd /c\"urspruenlicher Befehl\" */

Expand Down Expand Up @@ -158,6 +162,28 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
proc.waitFor();

Util.switchOnConsole();
// Kontrolle ob die Reports existieren
if ( !report.exists() ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT,
report.getAbsolutePath() ) );
if ( !reportId.exists() ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT,
reportId.getAbsolutePath() ) );
return false;
}
return false;
}
if ( !reportId.exists() ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT,
reportId.getAbsolutePath() ) );
return false;
}
} catch ( Exception e ) {
getMessageService()
.logError(
Expand Down Expand Up @@ -202,6 +228,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
BufferedReader in = new BufferedReader( new FileReader( report ) );
String line;
boolean allNull = false;
boolean allExist = false;

while ( (line = in.readLine()) != null ) {

Expand All @@ -221,6 +248,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
if ( line.contains( " all: 0" ) ) {
allNull = true;
} else {
allExist = true;
/* Invalide Px extrahieren " all: 3563" extrahieren */
String lineReportAll = line.substring( 9 );
try {
Expand All @@ -238,10 +266,17 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
}
}
in.close();
if ( !allExist ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_IMCMP_NOALL ) );
return false;
}
} catch ( Exception e ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_UNKNOWN, e.getMessage() ) );
+ getTextResourceService()
.getText( ERROR_XML_UNKNOWN, "compare: " + e.getMessage() ) );
return false;
}
} catch ( Exception e ) {
Expand Down Expand Up @@ -289,7 +324,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
}
}

// TODO: Marker: Auwertung und Fehlerausgabe wenn nicht bestanden.
// TODO: Marker: Auswertung und Fehlerausgabe wenn nicht bestanden.
}
if ( !imgPx1.equals( imgPx2 ) ) {
// die beiden Bilder haben nicht gleich viel Pixels
Expand All @@ -309,18 +344,16 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
// Bildvergleich nicht bestanden
if ( allNoInt ) {
/* Bilder mit vielen Pixels die Abweichen (Potenz -> String): Vereinfachte Fehlerausgabe */
double z2 = 0;

/* Invalide [allStr] und total px z2 aus imgPx1 " Pixels: 8809392" extrahieren */
String lineReport = imgPx1.substring( 12 );
// lineReport = 8809392
z2 = Double.parseDouble( lineReport );

isValid = false;

getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_CI_CIINVALIDSTR, z2,
+ getTextResourceService().getText( ERROR_XML_CI_CIINVALIDSTR, lineReport,
imToleranceTxt, allStr ) );

} else {
Expand All @@ -340,7 +373,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
percentageCalc = (float) (100 - (100 / z2 * z1));
percentageCalcInv = 100 - percentageCalc;

// Prozetzahlen vergleichen
// Prozentzahlen vergleichen
if ( percentageInvalid > percentageCalc ) {
// Bilder mit einer grösseren Abweichung
isValid = false;
Expand All @@ -354,9 +387,11 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile
}
in.close();
} catch ( Exception e ) {
getMessageService().logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_UNKNOWN, e.getMessage() ) );
getMessageService()
.logError(
getTextResourceService().getText( MESSAGE_XML_MODUL_CI )
+ getTextResourceService().getText( ERROR_XML_UNKNOWN,
"identify: " + e.getMessage() ) );
return false;
}
// reports löschen
Expand Down
Expand Up @@ -85,6 +85,7 @@ public interface MessageConstants
String ERROR_XML_IMCMP_MISSING = "error.xml.imcmp.missing";
String ERROR_XML_IMCMP_SERVICEFAILED = "error.xml.imcmp.servicefailed";
String ERROR_XML_IMCMP_NOREPORT = "error.xml.imcmp.noreport";
String ERROR_XML_IMCMP_NOALL = "error.xml.imcmp.noall";
String ERROR_XML_CI_CIINVALID = "error.xml.ci.ciinvalid";
String ERROR_XML_CI_CIINVALIDSTR = "error.xml.ci.ciinvalidstr";
String ERROR_XML_CI_SIZEINVALID = "error.xml.ci.sizeinvalid";
Expand Down
5 changes: 3 additions & 2 deletions KOST-Simy/src/main/resources/de_messages.properties
Expand Up @@ -26,7 +26,7 @@ message.xml.header = <?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet
message.xml.start = <Infos><Start>{0}</Start>
message.xml.end = <End></End>
message.xml.formaton = <FormatValOn>{0}</FormatValOn>
message.xml.info = <Info>KOST-Simy v0.0.4, Copyright (C) 2015 Claire Roethlisberger (KOST-CECO). This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see GPL-3.0_COPYING.txt for details</Info></Infos>
message.xml.info = <Info>KOST-Simy v0.0.5, Copyright (C) 2015 Claire Roethlisberger (KOST-CECO). This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see GPL-3.0_COPYING.txt for details</Info></Infos>
message.xml.valergebnis = <Comparison>
message.comparison = Bildvergleich
message.compfiles = <ValFile>{0} - {1}</ValFile>
Expand Down Expand Up @@ -63,8 +63,9 @@ error.xml.pdfa.ccitt = <Message>In der PDF-Datei sind {0} CCITT enthalten. Unter

# Modul CI
error.xml.imcmp.missing = <Message>Compare.exe von ImageMagick existiert nicht in den Ressourcen. Bitte Originalressourcen nicht veraendern.</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
error.xml.imcmp.servicefailed = <Message>Bei der Verwendung von ImageMagickCompare ist eine unbekannter Fehler aufgetreten.</Message><Message> -> Fehler: {0}</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
error.xml.imcmp.servicefailed = <Message>Bei der Verwendung von ImageMagickCompare ist ein unbekannter Fehler aufgetreten.</Message><Message> -> Fehler: {0}</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
error.xml.imcmp.noreport = <Message>Das System kann {0} nicht finden!</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
error.xml.imcmp.noall = <Message>Bei der Verwendung von ImageMagickCompare ist ein Fehler aufgetreten.</Message><Message> -> Fehler: Das Compare-Resultat wurde nicht ausgegeben.</Message><Message> -> Ursache: Ueberpruefen Sie, dass kein Leerschlag im KOST-Simy-Pfad ist.</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
error.xml.ci.ciinvalid = <Message>Der ImageMagickCompare-Vergleich wurde nicht bestanden.</Message><Message> -> {0}% ({3}px von {1}px) unterscheiden sich.</Message><Message> -> Konfigurierte Toleranz: {2}.</Message></Error>
error.xml.ci.ciinvalidstr = <Message>Der ImageMagickCompare-Vergleich wurde nicht bestanden.</Message><Message> -> {2}px von {0}px unterscheiden sich.</Message><Message> -> Konfigurierte Toleranz: {1}.</Message></Error>
error.xml.ci.sizeinvalid = <Message>Die Beiden Bilder sind nicht gleich gross:</Message><Message> -> Original {0} - Replica {1}.</Message><Message> -> Bildvergleich abgebrochen!</Message></Error>
Expand Down
2 changes: 1 addition & 1 deletion KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_de.nsi
@@ -1,5 +1,5 @@
; The name of the installer
Name "KOST-Simy v0.0.4"
Name "KOST-Simy v0.0.5"
; Sets the icon of the installer
Icon "simy.ico"
; remove the text 'Nullsoft Install System vX.XX' from the installer window
Expand Down
2 changes: 1 addition & 1 deletion KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_en.nsi
@@ -1,5 +1,5 @@
; The name of the installer
Name "KOST-Simy v0.0.4"
Name "KOST-Simy v0.0.5"
; Sets the icon of the installer
Icon "simy.ico"
; remove the text 'Nullsoft Install System vX.XX' from the installer window
Expand Down
2 changes: 1 addition & 1 deletion KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_fr.nsi
@@ -1,5 +1,5 @@
; The name of the installer
Name "KOST-Simy v0.0.4"
Name "KOST-Simy v0.0.5"
; Sets the icon of the installer
Icon "simy.ico"
; remove the text 'Nullsoft Install System vX.XX' from the installer window
Expand Down
Binary file modified KOST-Simy/src/main/resources_notJar/KOST-Simy_de.exe
Binary file not shown.
Binary file modified KOST-Simy/src/main/resources_notJar/KOST-Simy_en.exe
Binary file not shown.
Binary file modified KOST-Simy/src/main/resources_notJar/KOST-Simy_fr.exe
Binary file not shown.
Expand Up @@ -4,6 +4,11 @@
<pathtoworkdir>temp_KOST-Simy</pathtoworkdir>
<!--Stichprobengroesse (Zahl zwischen 1 und 100) wie viel Prozent verglichen werden soll -->
<randomtest>50</randomtest>
<!--Toleranz (N: null Toleranz S: kleine Toleranz, M, L, bis XL grosse Toleranz) -->
<!--Toleranz (N, S, M, L, XL)
N: Null Toleranz -> Pixelidentische Bilder
S: Kleine Toleranz -> Optisch identische Bilder
M: Mittlere Toleranz -> gerine Abweichungen, nahezu optisch identische Bilder
L: Grosse Toleranz -> kleine Abweichungen z.B. Kompressionsartefakte
XL: grosse Toleranz -> mittlere Abweichungen z.B. durch starke Komprimierung oder anti aliasing -->
<imtolerance>M</imtolerance>
</configuration>

0 comments on commit d3b54be

Please sign in to comment.