Commit d08a691d authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Add help link icons; adjust point cloud views

parent 9b876a14
Loading
Loading
Loading
Loading
+68 −0
Original line number Diff line number Diff line
package cz.fidentis.analyst.gui.elements;

import javax.swing.*;
import java.awt.*;
import java.net.URI;

/**
 * An info button/icon providing a link into some web page.
 * 
 * @author Radek Oslejsek
 */
public class InfoLinkButton extends JButton {

    /**
     * Link
     */
    private URI uri;

    /**
     * Constructor.
     */
    public InfoLinkButton() {
        initComponents();
    }

    /**
     * Constructor.
     * @param uri Link to the web page
     */
    public InfoLinkButton(URI uri) {
        this();
        setUri(uri);
    }
    
    public void setUri(URI uri) {
        this.uri = uri;
    }

    /**
     * Show an error window if the redirection to the URI fails.
     */
    public void showError() {
        JOptionPane.showMessageDialog(this,
                "Can't navigate to " + uri + System.lineSeparator() + "Put this address to your web browser manually.", 
                "Error",
                JOptionPane.WARNING_MESSAGE);
    }

    private void initComponents() {
        setText("");
        setIcon(new ImageIcon(getClass().getResource("/info.png"))); // NOI18N
        setBorderPainted(false);

        addActionListener(e -> {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(uri);
                    return;
                } catch (Exception ex) {
                    showError();
                }
            } else {
                showError();
            }
        });
    }

}
+0 −24
Original line number Diff line number Diff line
@@ -40,10 +40,7 @@ import java.util.Map;
 */
public class SymmetryAction extends ControlPanelAction<SymmetryPanel> implements HumanFaceListener  {

    private int sPlane = 0; // 0 = none, 1 = from mesh, 2 = from FPs
    
    private int primCloudSlot = -1;
    //private int secCloudSlot = -1;

    /**
     * Constructor. 
@@ -97,11 +94,9 @@ public class SymmetryAction extends ControlPanelAction<SymmetryPanel> implements
        switch (action) {
            case SymmetryPanel.ACTION_COMMAND_COMPUTE:
                if (getControlPanel().getAlgorithm().equals(SymmetryPanel.SYMMETRY_ALGORITHMS.get(3))) {
                    sPlane = 2;
                    recomputeFromFeaturePoints(getCanvas().getScene().getPrimaryFaceSlot());
                    recomputeFromFeaturePoints(getCanvas().getScene().getSecondaryFaceSlot());
                } else {
                    sPlane = 1;
                    recomputeFromMesh(getCanvas().getScene().getPrimaryFaceSlot());
                    recomputeFromMesh(getCanvas().getScene().getSecondaryFaceSlot());
                }
@@ -123,25 +118,6 @@ public class SymmetryAction extends ControlPanelAction<SymmetryPanel> implements
    
    @Override
    public void acceptEvent(HumanFaceEvent event) {
        /* symmetry plane is transformed together with the mesh
        if (event instanceof MeshChangedEvent) { // recompute symmetry plane, if necessary
            switch (sPlane) {
                case 0: // none
                    return;
                case 1: // from mesh
                    recomputeFromMesh(event.getFace().equals(getPrimaryDrawableFace().getHumanFace()) 
                            ? getCanvas().getScene().getPrimaryFaceSlot()
                            : getCanvas().getScene().getSecondaryFaceSlot());
                    break;
                case 2: // from FPs
                    recomputeFromFeaturePoints(event.getFace().equals(getPrimaryDrawableFace().getHumanFace())
                            ? getCanvas().getScene().getPrimaryFaceSlot() 
                            : getCanvas().getScene().getSecondaryFaceSlot());
                    break;
                default:
            }
        }
        */
        if (event instanceof SymmetryPlaneChangedEvent) {
            updatePrecision(event.getFace());
        }
+37 −80
Original line number Diff line number Diff line
@@ -16,23 +16,16 @@
  <Layout>
    <DimensionLayout dim="0">
      <Group type="103" groupAlignment="0" attributes="0">
          <Group type="102" alignment="0" attributes="0">
          <Group type="102" alignment="1" attributes="0">
              <EmptySpace max="-2" attributes="0"/>
              <Group type="103" groupAlignment="0" attributes="0">
                  <Group type="102" attributes="0">
                      <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
                  </Group>
                  <Group type="102" attributes="0">
              <Group type="103" groupAlignment="1" attributes="0">
                  <Component id="jPanel2" max="32767" attributes="0"/>
                  <Component id="jPanel3" max="32767" attributes="0"/>
                  <Component id="jPanel1" max="32767" attributes="0"/>
              </Group>
              <EmptySpace max="-2" attributes="0"/>
          </Group>
      </Group>
          </Group>
      </Group>
    </DimensionLayout>
    <DimensionLayout dim="1">
      <Group type="103" groupAlignment="0" attributes="0">
@@ -43,7 +36,7 @@
              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
              <EmptySpace max="-2" attributes="0"/>
              <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
              <EmptySpace pref="213" max="32767" attributes="0"/>
              <EmptySpace pref="276" max="32767" attributes="0"/>
          </Group>
      </Group>
    </DimensionLayout>
@@ -73,47 +66,31 @@
                  </Group>
                  <EmptySpace max="-2" attributes="0"/>
                  <Group type="103" groupAlignment="0" attributes="0">
                      <Group type="102" alignment="1" attributes="0">
                          <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
                          <Component id="jButtonInfo3" min="-2" max="-2" attributes="0"/>
                      </Group>
                      <Group type="102" attributes="0">
                          <Component id="jComboBox2" min="-2" max="-2" attributes="0"/>
                          <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
                          <EmptySpace max="-2" attributes="0"/>
                          <Component id="infoLinkButton2" min="-2" max="-2" attributes="0"/>
                      </Group>
                      <Group type="102" attributes="0">
                          <Group type="103" groupAlignment="0" attributes="0">
                      <Component id="spinSlider1" min="-2" max="-2" attributes="0"/>
                      <Component id="spinSlider2" min="-2" max="-2" attributes="0"/>
                  </Group>
                          <EmptySpace pref="27" max="32767" attributes="0"/>
                          <Group type="103" groupAlignment="0" max="-2" attributes="0">
                              <Component id="jButtonInfo2" max="32767" attributes="0"/>
                              <Component id="jButtonInfo1" max="32767" attributes="0"/>
                          </Group>
                      </Group>
                  </Group>
                  <EmptySpace max="-2" attributes="0"/>
                  <EmptySpace pref="74" max="32767" attributes="0"/>
              </Group>
          </Group>
        </DimensionLayout>
        <DimensionLayout dim="1">
          <Group type="103" groupAlignment="0" attributes="0">
              <Group type="102" alignment="0" attributes="0">
                  <EmptySpace max="-2" attributes="0"/>
                  <Component id="jButtonInfo3" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="-2" attributes="0"/>
                  <Group type="103" groupAlignment="3" attributes="0">
                      <Component id="jComboBox2" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="infoLinkButton2" alignment="0" min="-2" pref="35" max="-2" attributes="0"/>
                  </Group>
                  <Group type="103" groupAlignment="0" attributes="0">
                      <Group type="102" alignment="0" attributes="0">
                          <EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
                          <Group type="103" groupAlignment="0" max="-2" attributes="0">
                              <Component id="spinSlider1" max="32767" attributes="0"/>
                              <Component id="jButtonInfo1" pref="0" max="32767" attributes="0"/>
                          </Group>
                          <Component id="spinSlider1" min="-2" max="-2" attributes="0"/>
                      </Group>
                      <Group type="102" alignment="0" attributes="0">
                          <EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
@@ -121,15 +98,14 @@
                      </Group>
                  </Group>
                  <EmptySpace type="separate" max="-2" attributes="0"/>
                  <Group type="103" groupAlignment="0" max="-2" attributes="0">
                      <Component id="spinSlider2" max="32767" attributes="0"/>
                      <Component id="jButtonInfo2" pref="0" max="32767" attributes="0"/>
                  <Group type="103" groupAlignment="0" attributes="0">
                      <Component id="spinSlider2" min="-2" max="-2" attributes="0"/>
                      <Group type="102" alignment="0" attributes="0">
                          <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
                          <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
                      </Group>
                  </Group>
                  <EmptySpace pref="38" max="32767" attributes="0"/>
                  <EmptySpace max="32767" attributes="0"/>
              </Group>
          </Group>
        </DimensionLayout>
@@ -142,20 +118,6 @@
            </Property>
          </Properties>
        </Component>
        <Component class="javax.swing.JButton" name="jButtonInfo1">
          <Properties>
            <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
              <Image iconType="3" name="/info.png"/>
            </Property>
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
              <ResourceString bundle="cz/fidentis/analyst/gui/task/symmetry/Bundle.properties" key="SymmetryPanel.jButtonInfo1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
            </Property>
            <Property name="borderPainted" type="boolean" value="false"/>
          </Properties>
          <Events>
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonInfo1ActionPerformed"/>
          </Events>
        </Component>
        <Component class="javax.swing.JLabel" name="jLabel9">
          <Properties>
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@@ -185,31 +147,11 @@
            </Property>
          </Properties>
        </Component>
        <Component class="javax.swing.JButton" name="jButtonInfo2">
          <Properties>
            <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
              <Image iconType="3" name="/info.png"/>
            </Property>
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
              <ResourceString bundle="cz/fidentis/analyst/gui/task/symmetry/Bundle.properties" key="SymmetryPanel.jButtonInfo2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
            </Property>
            <Property name="borderPainted" type="boolean" value="false"/>
          </Properties>
        </Component>
        <Component class="cz.fidentis.analyst.gui.elements.SpinSlider" name="spinSlider2">
        </Component>
        <Component class="javax.swing.JButton" name="jButtonInfo3">
          <Properties>
            <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
              <Image iconType="3" name="/info.png"/>
            </Property>
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
              <ResourceString bundle="cz/fidentis/analyst/gui/task/symmetry/Bundle.properties" key="SymmetryPanel.jButtonInfo3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
            </Property>
            <Property name="borderPainted" type="boolean" value="false"/>
          </Properties>
        <Component class="cz.fidentis.analyst.gui.elements.InfoLinkButton" name="infoLinkButton2">
          <Events>
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonInfo3ActionPerformed"/>
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="infoLinkButton2ActionPerformed"/>
          </Events>
        </Component>
      </SubComponents>
@@ -218,7 +160,7 @@
      <Properties>
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
            <TitledBorder title="Precision (0 = best fit): ">
            <TitledBorder title="Precision: ">
              <ResourceString PropertyName="titleX" bundle="cz/fidentis/analyst/gui/task/symmetry/Bundle.properties" key="SymmetryPanel.jPanel2.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
              <Font PropertyName="font" name="Dialog" size="12" style="1"/>
            </TitledBorder>
@@ -238,7 +180,9 @@
                  <Component id="jLabel8" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="-2" attributes="0"/>
                  <Component id="jTextField2" min="-2" pref="55" max="-2" attributes="0"/>
                  <EmptySpace pref="21" max="32767" attributes="0"/>
                  <EmptySpace max="-2" attributes="0"/>
                  <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="32767" attributes="0"/>
              </Group>
          </Group>
        </DimensionLayout>
@@ -251,8 +195,9 @@
                      <Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
                  </Group>
                  <EmptySpace max="32767" attributes="0"/>
                  <EmptySpace pref="18" max="32767" attributes="0"/>
              </Group>
          </Group>
        </DimensionLayout>
@@ -286,6 +231,13 @@
            </Property>
          </Properties>
        </Component>
        <Component class="javax.swing.JLabel" name="jLabel2">
          <Properties>
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
              <ResourceString bundle="cz/fidentis/analyst/gui/task/symmetry/Bundle.properties" key="SymmetryPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
            </Property>
          </Properties>
        </Component>
      </SubComponents>
    </Container>
    <Container class="javax.swing.JPanel" name="jPanel3">
@@ -310,6 +262,8 @@
                  <Component id="selectableComboBox1" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="-2" attributes="0"/>
                  <Component id="jButton2" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="-2" attributes="0"/>
                  <Component id="infoLinkButton1" min="-2" max="-2" attributes="0"/>
                  <EmptySpace max="32767" attributes="0"/>
              </Group>
          </Group>
@@ -322,6 +276,7 @@
                      <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="selectableComboBox1" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
                      <Component id="infoLinkButton1" alignment="0" min="-2" pref="35" max="-2" attributes="0"/>
                  </Group>
                  <EmptySpace max="32767" attributes="0"/>
              </Group>
@@ -351,6 +306,8 @@
            </Property>
          </Properties>
        </Component>
        <Component class="cz.fidentis.analyst.gui.elements.InfoLinkButton" name="infoLinkButton1">
        </Component>
      </SubComponents>
    </Container>
  </SubComponents>
+53 −133

File changed.

Preview size limit exceeded, changes collapsed.

+2 −4
Original line number Diff line number Diff line
@@ -21,19 +21,16 @@ SymmetryPanelNew.minNormAngleCosTF.text=
SymmetryPanelNew.maxRelDistTF.text=
SymmetryPanelNew.averaging.text=
SymmetryPanel.jButton2.text=Compute
SymmetryPanel.jPanel2.border.title=Precision (0 = best fit): 
SymmetryPanel.jPanel2.border.title=Precision: 
SymmetryPanel.jTextField1.text=
SymmetryPanel.jLabel7.text=Face 1:
SymmetryPanel.jLabel8.text=Face 2:
SymmetryPanel.jTextField2.text=
SymmetryPanel.jPanel3.border.title=Strategy
SymmetryPanel.jLabel9.text=Point sampling strategy
SymmetryPanel.jButtonInfo1.text=
SymmetryPanel.jLabel1.text_1=Sampling strength 1
SymmetryPanel.jPanel1.border.title_1=Symmetry from mesh
SymmetryPanel.jButtonInfo2.text=
SymmetryPanel.jLabel3.text=Sampling strength 2
SymmetryPanel.jButtonInfo3.text=
ProfilesPanel.text=jLabel4
CuttingPlanesPanel.hausdorffDistancePanel.border.title=Cross-section similarity
CuttingPlanesPanel.jButton1.text=Export
@@ -55,3 +52,4 @@ CuttingPlanesPanel.jButtonSamplingInfo.text=
CuttingPlanesPanel.showNormalsCheckBox.text=Show normal vectors
CuttingPlanesPanel.vectorSizeLabel.text=Vector size:
SymmetryPanel.jLabel4.text=Compute from
SymmetryPanel.jLabel2.text=0 = the best fit
Loading