Commit 655ca184 authored by Piotr Wendykier's avatar Piotr Wendykier

Merge branch 'merge_cell_sets' into 'develop'

Merging of cell sets

Closes #106

See merge request !108
parents 967f4b95 be392f7c
Pipeline #38827719 passed with stage
in 0 seconds
......@@ -66,6 +66,7 @@
<core package="pl.edu.icm.visnow.lib.basic.filters.Boundaries"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.ConvexHull"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.GeometricCrop"/>
<core package="pl.edu.icm.visnow.lib.basic.filters.MergeCellSets"/>
</folder>
<folder name="data filters" autohelpfile="pl.edu.icm.visnow.lib.basic.filters.help_folder_data.html" autosort="yes">
<core package="pl.edu.icm.visnow.lib.basic.filters.ComponentCalculator"/>
......
......@@ -36,7 +36,6 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
//</editor-fold>
package pl.edu.icm.visnow.lib.basic.filters.CellToNode;
import java.util.ArrayList;
......@@ -55,7 +54,8 @@ import static pl.edu.icm.visnow.lib.basic.filters.CellToNode.CellToNodeShared.DR
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNIrregularField;
import pl.edu.icm.visnow.lib.utils.SwingInstancer;
import static pl.edu.icm.visnow.lib.utils.field.CellToNode.convertCellDataToNodeData;
import static pl.edu.icm.visnow.lib.utils.field.CellToNode.*;
/**
* @author Krzysztof S. Nowinski (know@icm.edu.pl)
* Warsaw University, Interdisciplinary Centre
......@@ -110,19 +110,15 @@ public class CellToNode extends OutFieldVisualizationModule
computeUI.updateGUI(clonedParameterProxy);
}
@Override
public void onActive()
{
if (getInputFirstValue("inField") != null) {
inField = ((VNIrregularField) getInputFirstValue("inField")).getField();
outIrregularField = inField.cloneShallow();
Parameters p = parameters.getReadOnlyClone();
notifyGUIs(p, true, true);
convertCellDataToNodeData(p.get(DROP), inField , outIrregularField);
outIrregularField = convertCellDataToNodeData(p.get(DROP), inField);
setOutputValue("outField", new VNIrregularField(outIrregularField));
outField = outIrregularField;
prepareOutputGeometry();
......
//<editor-fold defaultstate="collapsed" desc=" COPYRIGHT AND LICENSE ">
/* VisNow
Copyright (C) 2006-2013 University of Warsaw, ICM
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
University of Warsaw, Interdisciplinary Centre for Mathematical and
Computational Modelling, Pawinskiego 5a, 02-106 Warsaw, Poland.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
//</editor-fold>
package pl.edu.icm.visnow.lib.basic.filters.MergeCellSets;
import pl.edu.icm.visnow.engine.core.InputEgg;
import pl.edu.icm.visnow.engine.core.OutputEgg;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
import pl.edu.icm.visnow.lib.types.VNField;
import pl.edu.icm.visnow.lib.types.VNIrregularField;
import static pl.edu.icm.visnow.lib.utils.field.MergeIrregularField.mergeCellSet;
/**
* @author Krzysztof S. Nowinski (know@icm.edu.pl)
* Warsaw University, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class MergeCellSets extends OutFieldVisualizationModule
{
/**
* Creates a new instance of SurfaceSmoother
*/
public static InputEgg[] inputEggs = null;
public static OutputEgg[] outputEggs = null;
public MergeCellSets()
{
setPanel(ui);
}
@Override
public void onActive()
{
if (getInputFirstValue("inField") == null || ((VNField) getInputFirstValue("inField")).getField() == null)
return;
outField = outIrregularField = mergeCellSet(((VNIrregularField)getInputFirstValue("inField")).getField());
setOutputValue("outField", new VNIrregularField(outIrregularField));
prepareOutputGeometry();
show();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<module name="merge cell sets" class="MergeCellSets">
<inputs>
<input name="inField" type="pl.edu.icm.visnow.lib.types.VNIrregularField" modifiers="NECESSARY:TRIGGERING">
</input>
</inputs>
<outputs>
<output name="outField" type="pl.edu.icm.visnow.lib.types.VNIrregularField">
<schema>
<param name="IRREGULAR" value="true"/>
</schema>
</output>
<geometryOutput/>
</outputs>
<parameters>
</parameters>
<description value="merges all cell sets in input field to a single cell set"/>
</module>
......@@ -205,14 +205,14 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="9" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="9" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="10" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="0" gridY="10" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="10" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
......@@ -237,5 +237,19 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JCheckBox" name="mergeCellSetsCB">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="merge cell sets"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mergeCellSetsCBActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>
......@@ -98,7 +98,8 @@ public class GUI extends javax.swing.JPanel
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
private void initComponents()
{
java.awt.GridBagConstraints gridBagConstraints;
selectButton = new javax.swing.JButton();
......@@ -113,6 +114,7 @@ public class GUI extends javax.swing.JPanel
displayCB = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane();
fieldDescription = new javax.swing.JLabel();
mergeCellSetsCB = new javax.swing.JCheckBox();
setBorder(javax.swing.BorderFactory.createTitledBorder(""));
setMinimumSize(new java.awt.Dimension(180, 500));
......@@ -125,8 +127,10 @@ public class GUI extends javax.swing.JPanel
selectButton.setMaximumSize(new java.awt.Dimension(90, 20));
selectButton.setMinimumSize(new java.awt.Dimension(90, 20));
selectButton.setPreferredSize(new java.awt.Dimension(90, 20));
selectButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
selectButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
selectButtonActionPerformed(evt);
}
});
......@@ -140,8 +144,10 @@ public class GUI extends javax.swing.JPanel
fileNameField.setMinimumSize(new java.awt.Dimension(4, 20));
fileNameField.setPreferredSize(new java.awt.Dimension(4, 22));
fileNameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileNameField.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
fileNameFieldActionPerformed(evt);
}
});
......@@ -166,8 +172,10 @@ public class GUI extends javax.swing.JPanel
rereadButton.setMaximumSize(new java.awt.Dimension(90, 20));
rereadButton.setMinimumSize(new java.awt.Dimension(90, 20));
rereadButton.setPreferredSize(new java.awt.Dimension(90, 20));
rereadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rereadButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
rereadButtonActionPerformed(evt);
}
});
......@@ -187,10 +195,13 @@ public class GUI extends javax.swing.JPanel
scaleSlider.setShowingFields(true);
scaleSlider.setValue(new Float(1));
scaleSlider.setEnabled(false);
scaleSlider.addUserActionListener(new pl.edu.icm.visnow.gui.swingwrappers.UserActionListener() {
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt) {
scaleSlider.addUserActionListener(new pl.edu.icm.visnow.gui.swingwrappers.UserActionListener()
{
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
}
public void userAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt) {
public void userAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
scaleSliderUserAction(evt);
}
});
......@@ -205,8 +216,10 @@ public class GUI extends javax.swing.JPanel
dropConstantCB.setSelected(true);
dropConstantCB.setText("drop constant components");
dropConstantCB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dropConstantCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
dropConstantCBActionPerformed(evt);
}
});
......@@ -219,8 +232,10 @@ public class GUI extends javax.swing.JPanel
add(dropConstantCB, gridBagConstraints);
rescaleCB.setText("rescale geometry:");
rescaleCB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rescaleCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
rescaleCBActionPerformed(evt);
}
});
......@@ -234,8 +249,10 @@ public class GUI extends javax.swing.JPanel
cellToNodeCB.setSelected(true);
cellToNodeCB.setText("convert cell data to node data");
cellToNodeCB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cellToNodeCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
cellToNodeCBActionPerformed(evt);
}
});
......@@ -247,8 +264,10 @@ public class GUI extends javax.swing.JPanel
dropCellDataCB.setSelected(true);
dropCellDataCB.setText("drop cell data");
dropCellDataCB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dropCellDataCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
dropCellDataCBActionPerformed(evt);
}
});
......@@ -262,14 +281,16 @@ public class GUI extends javax.swing.JPanel
displayCB.setSelected(true);
displayCB.setText("show");
displayCB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
displayCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayCBActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridy = 9;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
add(displayCB, gridBagConstraints);
......@@ -282,7 +303,7 @@ public class GUI extends javax.swing.JPanel
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 9;
gridBagConstraints.gridy = 10;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
......@@ -290,6 +311,21 @@ public class GUI extends javax.swing.JPanel
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
add(jScrollPane1, gridBagConstraints);
mergeCellSetsCB.setSelected(true);
mergeCellSetsCB.setText("merge cell sets");
mergeCellSetsCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
mergeCellSetsCBActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(mergeCellSetsCB, gridBagConstraints);
}// </editor-fold>//GEN-END:initComponents
private void selectButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_selectButtonActionPerformed
......@@ -366,6 +402,13 @@ public class GUI extends javax.swing.JPanel
parameters.setParameterActive(true);
}//GEN-LAST:event_dropConstantCBActionPerformed
private void mergeCellSetsCBActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mergeCellSetsCBActionPerformed
{//GEN-HEADEREND:event_mergeCellSetsCBActionPerformed
parameters.setParameterActive(false);
parameters.set(MERGE_CELL_SETS, mergeCellSetsCB.isSelected());
parameters.setParameterActive(true);
}//GEN-LAST:event_mergeCellSetsCBActionPerformed
private void processCasFileSelection(String casPath)
{
parameters.setParameterActive(false);
......@@ -459,6 +502,7 @@ public class GUI extends javax.swing.JPanel
private javax.swing.JLabel fieldDescription;
private javax.swing.JTextField fileNameField;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox mergeCellSetsCB;
private javax.swing.JLabel moduleLabel;
private javax.swing.JButton rereadButton;
private javax.swing.JCheckBox rescaleCB;
......
......@@ -86,7 +86,7 @@ public class MemoryFileImageInputStream {
* <code>java.io.EOFException</code> will be thrown only if a read is
* performed.
*
* @param pos an <code>int</code> containing the desired file
* @param i an <code>int</code> containing the desired file
* pointer position.
*
* @exception IndexOutOfBoundsException if <code>pos</code> is smaller
......
......@@ -38,18 +38,18 @@
//</editor-fold>
package pl.edu.icm.visnow.lib.basic.readers.ReadFluent;
import java.util.ArrayList;
import pl.edu.icm.jlargearrays.FloatLargeArray;
import pl.edu.icm.jscic.CellSet;
import pl.edu.icm.jscic.cells.Cell;
import pl.edu.icm.jscic.cells.CellType;
import pl.edu.icm.jscic.IrregularField;
import pl.edu.icm.jscic.dataarrays.DataArray;
import pl.edu.icm.jscic.dataarrays.DataArrayType;
import pl.edu.icm.visnow.engine.core.OutputEgg;
import pl.edu.icm.visnow.engine.core.Parameter;
import pl.edu.icm.visnow.engine.core.ParameterChangeListener;
import pl.edu.icm.visnow.engine.core.Parameters;
import pl.edu.icm.visnow.geometries.parameters.PresentationParams;
import pl.edu.icm.visnow.geometries.parameters.RenderingParams;
import pl.edu.icm.visnow.gui.events.FloatValueModificationEvent;
import pl.edu.icm.visnow.gui.events.FloatValueModificationListener;
import pl.edu.icm.visnow.lib.templates.visualization.modules.OutFieldVisualizationModule;
......@@ -59,6 +59,7 @@ import static pl.edu.icm.visnow.lib.basic.readers.ReadFluent.ReadFluentShared.*;
import static pl.edu.icm.visnow.lib.utils.field.CellToNode.*;
import pl.edu.icm.visnow.lib.utils.field.GeometricOrientation;
import pl.edu.icm.visnow.lib.utils.field.VectorComponentCombiner;
import static pl.edu.icm.visnow.lib.utils.field.MergeIrregularField.mergeCellSet;
/**
* @author Bartosz Borucki (babor@icm.edu.pl) Warsaw University,
......@@ -109,6 +110,7 @@ public class ReadFluent extends OutFieldVisualizationModule
new Parameter<>(SCALE, 1.0f),
new Parameter<>(CELL_TO_NODE, true),
new Parameter<>(DROP_CELL_DATA, true),
new Parameter<>(MERGE_CELL_SETS, true),
new Parameter<>(DROP_CONSTANT_DATA, true),
};
}
......@@ -131,7 +133,7 @@ public class ReadFluent extends OutFieldVisualizationModule
@Override
public void onActive()
{
IrregularField rawField = null, transientField = null;
Parameters p;
synchronized (parameters) {
p = parameters.getReadOnlyClone();
......@@ -162,35 +164,38 @@ public class ReadFluent extends OutFieldVisualizationModule
}
this.setProgress(0.33f);
iTask = 1;
rawField = reader.requestData(p.get(SCALE));
outIrregularField = reader.requestData(p.get(SCALE));
this.setProgress(0.66f);
iTask = 2;
if (rawField != null) {
GeometricOrientation.recomputeOrientations(rawField);
if (parameters.get(CELL_TO_NODE)) {
transientField = rawField.cloneShallow();
convertCellDataToNodeData(parameters.get(DROP_CELL_DATA), rawField, transientField);
}
if (outIrregularField != null) {
GeometricOrientation.recomputeOrientations(outIrregularField);
VectorComponentCombiner.combineVectors(outIrregularField);
if (parameters.get(DROP_CONSTANT_DATA)) {
for (int i = transientField.getNComponents() - 1; i >= 0; i--) {
DataArray component = transientField.getComponent(i);
for (int i = outIrregularField.getNComponents() - 1; i >= 0; i--) {
DataArray component = outIrregularField.getComponent(i);
if (component.getMinValue() == component.getMaxValue()) {
transientField.removeComponent(i);
outIrregularField.removeComponent(i);
}
}
for (int c = 0; c < transientField.getNCellSets(); c++) {
for (int i = transientField.getCellSet(c).getNComponents() - 1; i >= 0; i--) {
DataArray component = transientField.getCellSet(c).getComponent(i);
for (int c = 0; c < outIrregularField.getNCellSets(); c++) {
for (int i = outIrregularField.getCellSet(c).getNComponents() - 1; i >= 0; i--) {
DataArray component = outIrregularField.getCellSet(c).getComponent(i);
if (component.getMinValue() == component.getMaxValue()) {
transientField.getCellSet(c).removeComponent(i);
outIrregularField.getCellSet(c).removeComponent(i);
}
}
}
}
outIrregularField = VectorComponentCombiner.combineVectors(transientField);
if (parameters.get(CELL_TO_NODE))
outIrregularField = convertCellDataToNodeData(parameters.get(DROP_CELL_DATA), outIrregularField);
if (parameters.get(MERGE_CELL_SETS))
outIrregularField = mergeCellSet(outIrregularField);
if (outIrregularField.getNComponents() == 0) {
outIrregularField.addComponent(DataArray.createConstant(DataArrayType.FIELD_DATA_BYTE, outIrregularField.getNNodes(), 0, "dummy"));
......@@ -204,7 +209,7 @@ public class ReadFluent extends OutFieldVisualizationModule
this.setProgress(0.90f);
iTask = 3;
if(outIrregularField != null) {
if(outIrregularField != null) {
computeUI.setFieldDescription(outIrregularField.description());
setOutputValue("outField", new VNIrregularField(outIrregularField));
if (p.get(SHOW)) {
......@@ -220,6 +225,9 @@ public class ReadFluent extends OutFieldVisualizationModule
setOutputValue("outField", null);
outField = null;
prepareOutputGeometry();
renderingParams.setShadingMode(RenderingParams.FLAT_SHADED);
for (PresentationParams csParams : presentationParams.getChildrenParams())
csParams.getRenderingParams().setShadingMode(RenderingParams.FLAT_SHADED);
}
this.setProgress(1.0f);
}
......
......@@ -51,6 +51,7 @@ public class ReadFluentShared
static final ParameterName<Boolean> SHOW = new ParameterName("Show");
static final ParameterName<Float> SCALE = new ParameterName("Scale");
static final ParameterName<Boolean> CELL_TO_NODE = new ParameterName("Cell to node");
static final ParameterName<Boolean> MERGE_CELL_SETS = new ParameterName("Merge cell sets");
static final ParameterName<Boolean> DROP_CELL_DATA = new ParameterName("Drop cell data");
static final ParameterName<Boolean> DROP_CONSTANT_DATA = new ParameterName("Drop constant data");
......
......@@ -71,7 +71,7 @@
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="0" gridY="9" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
......@@ -187,7 +187,21 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="7" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="8" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="mergeCellSetsCB">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="merge cell sets"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mergeCellSetsCBActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
......
......@@ -105,6 +105,7 @@ public class GUI extends javax.swing.JPanel
fileNameField = new pl.edu.icm.visnow.gui.swingwrappers.TextField();
cellToNodeBox = new javax.swing.JCheckBox();
dropCellDataBox = new javax.swing.JCheckBox();
mergeCellSetsCB = new javax.swing.JCheckBox();
setBorder(javax.swing.BorderFactory.createTitledBorder(""));
setMinimumSize(new java.awt.Dimension(180, 500));
......@@ -150,7 +151,7 @@ public class GUI extends javax.swing.JPanel
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridy = 9;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
......@@ -204,13 +205,13 @@ public class GUI extends javax.swing.JPanel
fileNameField.addUserActionListener(new pl.edu.icm.visnow.gui.swingwrappers.UserActionListener()
{
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
}
public void userAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
fileNameFieldUserAction(evt);
}
public void userChangeAction(pl.edu.icm.visnow.gui.swingwrappers.UserEvent evt)
{
}
});
fileNameField.addFocusListener(new java.awt.event.FocusAdapter()
{
......@@ -255,10 +256,25 @@ public class GUI extends javax.swing.JPanel
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 7;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(dropCellDataBox, gridBagConstraints);
mergeCellSetsCB.setSelected(true);
mergeCellSetsCB.setText("merge cell sets");
mergeCellSetsCB.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
mergeCellSetsCBActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 7;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(mergeCellSetsCB, gridBagConstraints);
}// </editor-fold>//GEN-END:initComponents
private void selectButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_selectButtonActionPerformed
......@@ -310,6 +326,13 @@ public class GUI extends javax.swing.JPanel
parameters.setParameterActive(true);
}//GEN-LAST:event_dropCellDataBoxActionPerformed
private void mergeCellSetsCBActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mergeCellSetsCBActionPerformed
{//GEN-HEADEREND:event_mergeCellSetsCBActionPerformed
parameters.setParameterActive(false);
parameters.set(MERGE_CELL_SETS, mergeCellSetsCB.isSelected());
parameters.setParameterActive(true);
}//GEN-LAST:event_mergeCellSetsCBActionPerformed
public void setFieldDescription(String s)
{
......@@ -326,6 +349,7 @@ public class GUI extends javax.swing.JPanel
private javax.swing.JCheckBox indicesBox;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox materialAsSetsCheckBox;
private javax.swing.JCheckBox mergeCellSetsCB;
private javax.swing.JLabel moduleLabel;
private javax.swing.JButton selectButton;
private javax.swing.JRadioButton urlButton;
......
......@@ -61,6 +61,7 @@ import static pl.edu.icm.visnow.lib.utils.field.CellToNode.convertCellDataToNode
import pl.edu.icm.visnow.lib.utils.field.GeometricOrientation;
import pl.edu.icm.visnow.lib.utils.field.VectorComponentCombiner;
import pl.edu.icm.visnow.lib.utils.io.InputSource;
import static pl.edu.icm.visnow.lib.utils.field.MergeIrregularField.mergeCellSet;
/**
* @author Krzysztof S. Nowinski (know@icm.edu.pl)
......@@ -115,6 +116,7 @@ public class ReadUCD extends OutFieldVisualizationModule
new Parameter<>(INDICES, true),
new Parameter<>(INPUT_SOURCE, InputSource.FILE),
new Parameter<>(CELL_TO_NODE, true),
new Parameter<>(MERGE_CELL_SETS, true),
new Parameter<>(DROP_CELL_DATA, true)
};
}
......@@ -158,9 +160,10 @@ public class ReadUCD extends OutFieldVisualizationModule
if (tmpField == null)
return;
GeometricOrientation.recomputeOrientations(tmpField);
IrregularField transientField = tmpField.cloneShallow();
if (parameters.get(CELL_TO_NODE))
convertCellDataToNodeData(parameters.get(DROP_CELL_DATA), tmpField, transientField);
IrregularField transientField =
parameters.get(CELL_TO_NODE) ?
convertCellDataToNodeData(parameters.get(DROP_CELL_DATA), tmpField) :
tmpField.cloneShallow();
outIrregularField = transientField.cloneShallow();
outIrregularField.removeComponents();
for (DataArray component : transientField.getComponents()) {
......@@ -170,6 +173,10 @@ public class ReadUCD extends OutFieldVisualizationModule
outIrregularField.addComponent(component.cloneShallow());
}
VectorComponentCombiner.combineVectors(outIrregularField);
if (parameters.get(MERGE_CELL_SETS))
outIrregularField = mergeCellSet(outIrregularField);
computeUI.setFieldDescription(outIrregularField.description());
setOutputValue("UCD field", new VNIrregularField(outIrregularField));
}
......
......@@ -15,6 +15,8 @@ public class ReadUCDShared {
static final ParameterName<Boolean> INDICES = new ParameterName("indices");
static final ParameterName<Integer> INPUT_SOURCE = new ParameterName("input source");
static final ParameterName<Boolean> CELL_TO_NODE = new ParameterName("Cell to node");
static final ParameterName<Boolean> MERGE_CELL_SETS = new ParameterName("Merge cell sets");
static final ParameterName<Boolean> DROP_CELL_DATA = new ParameterName("Drop cell data");
}