Program: 140911
Project: 140911
Buggy source:
protected void updateGUI(){
  updateLICSharpeningSliderLabels(licNormalsSharpeningLimitSlider,licNormalsSharpeningLimitLabel);
  updateLICSharpeningSliderLabels(licHeightsSharpeningLimitSlider,licHeightsSharpeningLimitLabel);
  flatAreasSlopeSlider.setValue((int)Math.round(model.flatAreasMinSlope * 10));
  flatAreasMinAreaSizeSpinner.setValue(model.flatAreasMinSize);
  flatAreasMaxHolesSizeSpinner.setValue(model.flatAreasMaxHolesSize);
  flatAreasBreachFillingIterationsSpinner.setValue(model.flatAreasBreachFillingIterations);
  flatAreasColorButton.setColor(new Color(model.flatAreasARGB,true));
  licNormalsFilterSizeSlider.setValue((int)Math.round(model.licNormalsFilterSize * 20));
  licNormalsIterationsSlider.setValue(model.licNormalsIterations);
  licNormalsCarvingSlider.setValue(model.licNormalsCarving);
  licNormalsBlurSlider.setValue((int)Math.round(model.licNormalsGaussianBlurRadius));
  licNormalsSharpeningSlider.setValue((int)Math.round(model.licNormalsSharpening * 100));
  licNormalsSharpeningLimitSlider.setValue((int)Math.round(model.getLicNormalsSharpeningLimit() * 100));
  licNormals4NeighborsRadioButton.setSelected(model.licNormalsNeighbors == Model.LICNeighbors.LIC_4);
  licNormalsLowQualityRadioButton.setSelected(model.licNormalsBoxFilter);
  licNormalsShowFlatAreasCheckBox.setSelected(model.foregroundVisualization == Model.ForegroundVisualization.FLAT_AREAS_MASK);
  licNormalsFlatAreasCheckBox.setSelected(model.licNormalsApplyFlatAreasMask);
  licHeightsFilterSizeSlider.setValue((int)Math.round(model.licHeightsFilterSize * 20));
  licHeightsIterationsSlider.setValue(model.licHeightsIterations);
  licHeightsBlurSlider.setValue((int)Math.round(model.licHeightsGaussianBlurRadius));
  licHeightsSharpeningSlider.setValue((int)Math.round(model.licHeightsSharpening * 100));
  licHeightsSharpeningLimitSlider.setValue((int)Math.round(model.licHeightsSharpeningLimit * 100));
  generalizationGaussianBlurRadiusSlider.setValue((int)Math.round(model.generalizationGaussianBlurRadius * 10));
  azimuthSlider.setValue(model.getAzimuth());
  localIlluminationCheckBox.setSelected(model.isLocalLightDirection());
  zenithSlider.setValue(model.zenith);
  ambientLightSlider.setValue((int)Math.round(model.ambientLight * 100));
  localIlluminationLevelOfDetailSlider.setValue((int)Math.round(model.getMaxBranchLengthThreshold()) * 1000);
  localIlluminationDouglasPeuckerToleranceSlider.setValue((int)Math.round(model.getDouglasPeuckerTolerancePx()));
  localIlluminationMaxAdjustmentSlider.setValue((int)Math.round(model.getLocalLightDirectionMaxAdjustmentDeg()));
  localIlluminationMinLineLengthSlider.setValue(model.getLocalLightDirectionMinLineLengthPx());
switch (model.foregroundVisualization) {
case NONE:
    overlayComboBox.setSelectedIndex(0);
  break;
case FLAT_AREAS_MASK:
overlayComboBox.setSelectedIndex(1);
break;
case ILLUMINATED_CONTOURS:
overlayComboBox.setSelectedIndex(2);
break;
case SHADED_CONTOURS:
overlayComboBox.setSelectedIndex(3);
break;
}
contoursShadowLineWidthHighValueField.setValue(model.contoursShadowWidthHigh);
contoursShadowLineWidthLowValueField.setValue(model.contoursShadowWidthLow);
contoursIlluminatedLineWidthHighValueField.setValue(model.contoursIlluminatedWidthHigh);
contoursIlluminatedLineWidthLowValueField.setValue(model.contoursIlluminatedWidthLow);
contoursMinLineWidthSlider.setValue((int)Math.round(model.contoursMinWidth * 10));
contoursMinDistanceSlider.setValue((int)Math.round(model.contoursMinDist * 10));
contoursGradientSlider.setValue(model.contoursGradientAngle);
contoursIntervalTextBox.setValue(model.contoursInterval);
contoursDespeckleSlider.setValue((int)Math.round(model.contoursAspectGaussBlur * 20D));
contoursTransitionSlider.setValue(model.contoursTransitionAngle);
verticalExaggerationFormattedTextField.setValue(model.shadingVerticalExaggeration);
colorGradientSlider.setValues(model.colorRamp.colorPositions,model.colorRamp.colors);
solidColorButton.setColor(model.solidColor);
planObliqueSlider.setValue(model.planObliqueAngle);
int nbrLaplacianBands=model.getLaplacianBandsCount();
localGridHighPassSlider.setEnabled(nbrLaplacianBands > 0);
if (nbrLaplacianBands > 0) {
localGridHighPassSlider.setMaximum(nbrLaplacianBands * 10);
java.util.Hashtable labels=localGridHighPassSlider.createStandardLabels(10);
java.util.Enumeration e=labels.elements();
while (e.hasMoreElements()) {
javax.swing.JComponent comp=(javax.swing.JComponent)e.nextElement();
if (comp instanceof javax.swing.JLabel) {
javax.swing.JLabel label=(javax.swing.JLabel)(comp);
String str=Integer.toString(Integer.parseInt(label.getText()) / 10);
label.setText(str);
}
}
localGridHighPassSlider.setLabelTable(labels);
}
localGridHighPassSlider.setValue((int)Math.round(model.getLocalGridHighPassWeight() * 10));
localGridStandardDeviationFilterSizeSlider.setValue(model.getLocalGridStandardDeviationLevels());
colorPopupMenu.removeAll();
for (ColorRamp cr : model.predefinedColorRamps) {
JMenuItem colorMenuItem=new JMenuItem(cr.name);
colorMenuItem.addActionListener(new java.awt.event.ActionListener(){
@Override public void actionPerformed(java.awt.event.ActionEvent evt){
JMenuItem menuItem=(JMenuItem)evt.getSource();
model.selectColorRamp(menuItem.getText());
colorGradientSlider.setValues(model.colorRamp.colorPositions,model.colorRamp.colors);
renderImage(REGULAR);
}
}
);
colorPopupMenu.add(colorMenuItem);
}
contoursIlluminatedColorButton.setColor(new Color(model.contoursIlluminatedColor));
contoursShadowedColorButton.setColor(new Color(model.contoursShadowedColor));
int exp=(int)Math.round(model.getColorLUTRenderer().getExponentP() * 10);
idwExponentSlider.setValue(exp);
idwRadioButton.setSelected(model.getColorLUTRenderer().isUseIDW());
if (model.getGeneralization() == Model.Generalization.EQUALIZER) {
Component[] sliders=equalizerSlidersPanel.getComponents();
int nbrSliders=sliders.length;
int nbrBands=model.getLaplacianBandsCount();
for (int i=0; i < nbrSliders; i++) {
JSlider slider=(JSlider)sliders[i];
slider.setEnabled(i < nbrBands);
if (i >= nbrBands) {
setSliderValueWithoutTriggeringEvent(slider,100);
}
}
}
updateVisualizationPanelsVisibility();
updateFilterPanelsVisibility();
}

Fixed version (ground truth):
protected void updateGUI(){
  updateLICSharpeningSliderLabels(licNormalsSharpeningLimitSlider,licNormalsSharpeningLimitLabel);
  updateLICSharpeningSliderLabels(licHeightsSharpeningLimitSlider,licHeightsSharpeningLimitLabel);
  flatAreasSlopeSlider.setValue((int)Math.round(model.flatAreasMinSlope * 10));
  flatAreasMinAreaSizeSpinner.setValue(model.flatAreasMinSize);
  flatAreasMaxHolesSizeSpinner.setValue(model.flatAreasMaxHolesSize);
  flatAreasBreachFillingIterationsSpinner.setValue(model.flatAreasBreachFillingIterations);
  flatAreasColorButton.setColor(new Color(model.flatAreasARGB,true));
  licNormalsFilterSizeSlider.setValue((int)Math.round(model.licNormalsFilterSize * 20));
  licNormalsIterationsSlider.setValue(model.licNormalsIterations);
  licNormalsCarvingSlider.setValue(model.licNormalsCarving);
  licNormalsBlurSlider.setValue((int)Math.round(model.licNormalsGaussianBlurRadius));
  licNormalsSharpeningSlider.setValue((int)Math.round(model.licNormalsSharpening * 100));
  licNormalsSharpeningLimitSlider.setValue((int)Math.round(model.getLicNormalsSharpeningLimit() * 100));
  licNormals4NeighborsRadioButton.setSelected(model.licNormalsNeighbors == Model.LICNeighbors.LIC_4);
  licNormalsLowQualityRadioButton.setSelected(model.licNormalsBoxFilter);
  licNormalsShowFlatAreasCheckBox.setSelected(model.foregroundVisualization == Model.ForegroundVisualization.FLAT_AREAS_MASK);
  licNormalsFlatAreasCheckBox.setSelected(model.licNormalsApplyFlatAreasMask);
  licHeightsFilterSizeSlider.setValue((int)Math.round(model.licHeightsFilterSize * 20));
  licHeightsIterationsSlider.setValue(model.licHeightsIterations);
  licHeightsBlurSlider.setValue((int)Math.round(model.licHeightsGaussianBlurRadius));
  licHeightsSharpeningSlider.setValue((int)Math.round(model.licHeightsSharpening * 100));
  licHeightsSharpeningLimitSlider.setValue((int)Math.round(model.licHeightsSharpeningLimit * 100));
  generalizationGaussianBlurRadiusSlider.setValue((int)Math.round(model.generalizationGaussianBlurRadius * 10));
  azimuthSlider.setValue(model.getAzimuth());
  localIlluminationCheckBox.setSelected(model.isLocalLightDirection());
  zenithSlider.setValue(model.zenith);
  ambientLightSlider.setValue((int)Math.round(model.ambientLight * 100));
  localIlluminationLevelOfDetailSlider.setValue((int)Math.round(model.getMaxBranchLengthThreshold() * 1000));
  localIlluminationDouglasPeuckerToleranceSlider.setValue((int)Math.round(model.getDouglasPeuckerTolerancePx()));
  localIlluminationMaxAdjustmentSlider.setValue((int)Math.round(model.getLocalLightDirectionMaxAdjustmentDeg()));
  localIlluminationMinLineLengthSlider.setValue(model.getLocalLightDirectionMinLineLengthPx());
switch (model.foregroundVisualization) {
case NONE:
    overlayComboBox.setSelectedIndex(0);
  break;
case FLAT_AREAS_MASK:
overlayComboBox.setSelectedIndex(1);
break;
case ILLUMINATED_CONTOURS:
overlayComboBox.setSelectedIndex(2);
break;
case SHADED_CONTOURS:
overlayComboBox.setSelectedIndex(3);
break;
}
contoursShadowLineWidthHighValueField.setValue(model.contoursShadowWidthHigh);
contoursShadowLineWidthLowValueField.setValue(model.contoursShadowWidthLow);
contoursIlluminatedLineWidthHighValueField.setValue(model.contoursIlluminatedWidthHigh);
contoursIlluminatedLineWidthLowValueField.setValue(model.contoursIlluminatedWidthLow);
contoursMinLineWidthSlider.setValue((int)Math.round(model.contoursMinWidth * 10));
contoursMinDistanceSlider.setValue((int)Math.round(model.contoursMinDist * 10));
contoursGradientSlider.setValue(model.contoursGradientAngle);
contoursIntervalTextBox.setValue(model.contoursInterval);
contoursDespeckleSlider.setValue((int)Math.round(model.contoursAspectGaussBlur * 20D));
contoursTransitionSlider.setValue(model.contoursTransitionAngle);
verticalExaggerationFormattedTextField.setValue(model.shadingVerticalExaggeration);
colorGradientSlider.setValues(model.colorRamp.colorPositions,model.colorRamp.colors);
solidColorButton.setColor(model.solidColor);
planObliqueSlider.setValue(model.planObliqueAngle);
int nbrLaplacianBands=model.getLaplacianBandsCount();
localGridHighPassSlider.setEnabled(nbrLaplacianBands > 0);
if (nbrLaplacianBands > 0) {
localGridHighPassSlider.setMaximum(nbrLaplacianBands * 10);
java.util.Hashtable labels=localGridHighPassSlider.createStandardLabels(10);
java.util.Enumeration e=labels.elements();
while (e.hasMoreElements()) {
javax.swing.JComponent comp=(javax.swing.JComponent)e.nextElement();
if (comp instanceof javax.swing.JLabel) {
javax.swing.JLabel label=(javax.swing.JLabel)(comp);
String str=Integer.toString(Integer.parseInt(label.getText()) / 10);
label.setText(str);
}
}
localGridHighPassSlider.setLabelTable(labels);
}
localGridHighPassSlider.setValue((int)Math.round(model.getLocalGridHighPassWeight() * 10));
localGridStandardDeviationFilterSizeSlider.setValue(model.getLocalGridStandardDeviationLevels());
colorPopupMenu.removeAll();
for (ColorRamp cr : model.predefinedColorRamps) {
JMenuItem colorMenuItem=new JMenuItem(cr.name);
colorMenuItem.addActionListener(new java.awt.event.ActionListener(){
@Override public void actionPerformed(java.awt.event.ActionEvent evt){
JMenuItem menuItem=(JMenuItem)evt.getSource();
model.selectColorRamp(menuItem.getText());
colorGradientSlider.setValues(model.colorRamp.colorPositions,model.colorRamp.colors);
renderImage(REGULAR);
}
}
);
colorPopupMenu.add(colorMenuItem);
}
contoursIlluminatedColorButton.setColor(new Color(model.contoursIlluminatedColor));
contoursShadowedColorButton.setColor(new Color(model.contoursShadowedColor));
int exp=(int)Math.round(model.getColorLUTRenderer().getExponentP() * 10);
idwExponentSlider.setValue(exp);
idwRadioButton.setSelected(model.getColorLUTRenderer().isUseIDW());
if (model.getGeneralization() == Model.Generalization.EQUALIZER) {
Component[] sliders=equalizerSlidersPanel.getComponents();
int nbrSliders=sliders.length;
int nbrBands=model.getLaplacianBandsCount();
for (int i=0; i < nbrSliders; i++) {
JSlider slider=(JSlider)sliders[i];
slider.setEnabled(i < nbrBands);
if (i >= nbrBands) {
setSliderValueWithoutTriggeringEvent(slider,100);
}
}
}
updateVisualizationPanelsVisibility();
updateFilterPanelsVisibility();
}