Commit ed4f1949 authored by Peter Čonga's avatar Peter Čonga Committed by Radek Ošlejšek
Browse files

Feat: Enable selection of a face on cutting planes of batch processing; fix...

Feat: Enable selection of a face on cutting planes of batch processing; fix artifacts appearing in cutting curves.
parent 25a5c8e3
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class BatchCurveRenderingPanel extends JPanel {
    
    private boolean showNormals = false;
    
    private List<Curve2d> averageCrossSectionCurves;
    private List<Curve2d> crossSectionCurves;

    private Vector3d currentCuttingPlaneNormal;
    private Box faceBoundingBox;
@@ -104,8 +104,8 @@ public class BatchCurveRenderingPanel extends JPanel {
     * @param primaryCrossSectionCurves cross-sections with primary face
     * @param secondaryCrossSectionCurves cross-sections with secondary face 
     */
    public void setCurves(List<Curve2d> averageCrossSectionCurves) {
        this.averageCrossSectionCurves = averageCrossSectionCurves;
    public void setCurves(List<Curve2d> crossSectionCurves) {
        this.crossSectionCurves = crossSectionCurves;
        repaint();
    }
    
@@ -113,8 +113,8 @@ public class BatchCurveRenderingPanel extends JPanel {
     * Getter for primary curves.
     * @return list of visible 2D curves for primary face
     */
    public List<Curve2d> get2DAverageCurves() {
        return averageCrossSectionCurves;
    public List<Curve2d> get2DCurves() {
        return crossSectionCurves;
    }
    
    /**
@@ -161,12 +161,12 @@ public class BatchCurveRenderingPanel extends JPanel {
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        if (averageCrossSectionCurves == null) {
        if (crossSectionCurves == null) {
            return;
        }
        
        for (Curve2d curve : averageCrossSectionCurves) {
            paintCurve(g2, curve, PRIMARY_COLOR, averageCrossSectionCurves.indexOf(curve) == highlightIndex);
        for (Curve2d curve : crossSectionCurves) {
            paintCurve(g2, curve, PRIMARY_COLOR, crossSectionCurves.indexOf(curve) == highlightIndex);
        }
    }

@@ -175,11 +175,8 @@ public class BatchCurveRenderingPanel extends JPanel {
            return;
        }
        
        //Curve2d subsampledCurve = curve.subSample(sampling);
        
        Point2d a = null;
        for (List<Point2d> segment : subsampledCurve.getCurveSegments()) {

            Point2d a = null;
            for (Point2d point : segment) {
                g2.setColor(faceColor);
                g2.setStroke(highlight ? HIGHLIGHT_STROKE : GRAPH_STROKE);
+78 −156

File changed.

Preview size limit exceeded, changes collapsed.

+28 −0
Original line number Diff line number Diff line
@@ -35,6 +35,11 @@
                      <Group type="103" groupAlignment="0" attributes="0">
                          <Component id="jLabel9" min="-2" max="-2" attributes="0"/>
                          <Component id="vertexReductionSpinSlider" min="-2" max="-2" attributes="0"/>
                          <Group type="102" attributes="0">
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
                              <EmptySpace type="separate" max="-2" attributes="0"/>
                              <Component id="jComboBox1" min="-2" max="-2" attributes="0"/>
                          </Group>
                      </Group>
                      <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
                  </Group>
@@ -49,6 +54,12 @@
              <EmptySpace max="-2" attributes="0"/>
              <Group type="103" groupAlignment="0" attributes="0">
                  <Group type="102" attributes="0">
                      <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
                      <Group type="103" groupAlignment="3" attributes="0">
                          <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
                          <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/>
                      </Group>
                      <EmptySpace type="separate" max="-2" attributes="0"/>
                      <Component id="jLabel9" min="-2" max="-2" attributes="0"/>
                      <EmptySpace max="-2" attributes="0"/>
                      <Component id="vertexReductionSpinSlider" min="-2" max="-2" attributes="0"/>
@@ -341,5 +352,22 @@
        </Property>
      </Properties>
    </Component>
    <Component class="javax.swing.JComboBox" name="jComboBox1">
      <Properties>
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
          <StringArray count="0"/>
        </Property>
      </Properties>
      <AuxValues>
        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
      </AuxValues>
    </Component>
    <Component class="javax.swing.JLabel" name="jLabel1">
      <Properties>
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
          <ResourceString bundle="cz/fidentis/analyst/gui/task/batch/symmetry/Bundle.properties" key="BatchCuttingPlanesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
        </Property>
      </Properties>
    </Component>
  </SubComponents>
</Form>
+67 −20

File changed.

Preview size limit exceeded, changes collapsed.

+5 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import java.awt.geom.Line2D;
import java.util.List;

import static cz.fidentis.analyst.symmetry.CuttingPlanesUtils.getBoundingBox2D;
import java.util.ArrayList;


/**
@@ -184,9 +185,11 @@ public class CurveRenderingPanel extends JPanel {
            return;
        }
        
        List<Color> asd = new ArrayList<>(List.of(Color.GREEN, Color.RED, Color.BLUE, Color.BLACK, Color.MAGENTA, Color.ORANGE));
        
        Curve2d subsampledCurve = curve.subSample(sampling);
        Point2d a = null;
        for (List<Point2d> segment : subsampledCurve.getCurveSegments()) {
            Point2d a = null;
            for (Point2d point : segment) {
                g2.setColor(faceColor);
                g2.setStroke(highlight ? HIGHLIGHT_STROKE : GRAPH_STROKE);
@@ -195,6 +198,7 @@ public class CurveRenderingPanel extends JPanel {
                    a = point;
                    continue;
                }
                // If new curve segment, find the closes point on segment[0]

                Point2d b = point;

@@ -203,7 +207,6 @@ public class CurveRenderingPanel extends JPanel {
                        a.y * scale + offsetY,
                        b.x * scale + offsetX,
                        b.y * scale + offsetY));

                a = b;
            }
        }
Loading