00001
00002
00003
00004
00005 #ifndef BALL_VIEW_DIALOGS_MODIFYSURFACEDIALOG_H
00006 #define BALL_VIEW_DIALOGS_MODIFYSURFACEDIALOG_H
00007
00008 #ifndef BALL_COMMON_GLOBAL_H
00009 # include <BALL/COMMON/global.h>
00010 #endif
00011
00012 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00013 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00014 #endif
00015
00016 #ifndef BALL_VIEW_PRIMITIVES_MESH_H
00017 # include <BALL/VIEW/PRIMITIVES/mesh.h>
00018 #endif
00019
00020 #ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
00021 # include <BALL/VIEW/KERNEL/representation.h>
00022 #endif
00023
00024 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00025 # include <BALL/VIEW/KERNEL/modularWidget.h>
00026 #endif
00027
00028 #ifndef BALL_DATATYPE_REGULARDATA3D
00029 # include <BALL/DATATYPE/regularData3D.h>
00030 #endif
00031
00032 #ifndef BALL_DATATYPE_HASHGRID_H
00033 # include <BALL/DATATYPE/hashGrid.h>
00034 #endif
00035
00036 #ifndef BALL_VIEW_DIALOG_MATERIALSETTINGS_H
00037 # include <BALL/VIEW/DIALOGS/materialSettings.h>
00038 #endif
00039
00040 #include <BALL/VIEW/UIC/ui_modifyRepresentationDialog.h>
00041
00042 namespace BALL
00043 {
00044 namespace VIEW
00045 {
00051 class BALL_VIEW_EXPORT ModifyRepresentationDialog
00052 : public QDialog,
00053 public Ui_ModifyRepresentationDialogData,
00054 public ModularWidget
00055 {
00056 Q_OBJECT
00057
00058 public:
00059
00060 BALL_EMBEDDABLE(ModifyRepresentationDialog, ModularWidget)
00061
00062
00063 ModifyRepresentationDialog(QWidget* parent = 0, const char* name = "ModifyRepresentationDialog",
00064 bool modal = FALSE, Qt::WFlags fl = 0);
00065
00067 ~ModifyRepresentationDialog();
00068
00070 virtual void onNotify(Message *message);
00071
00073 void setRepresentation(Representation* rep);
00074
00076 void setGrid(RegularData3D* grid);
00077
00079 void setMinValue(float value);
00080
00082 void setMaxValue(float value);
00083
00085 void setMidValue(float value);
00086
00088 void setSplitRadius(float distance);
00089
00091 void setMode(Position pos);
00092
00093 public slots:
00094
00095 void applyPressed();
00096 void cancelPressed();
00097 void maxPressed();
00098 void midPressed();
00099 void minPressed();
00100 void minMinPressed();
00101 void maxMaxPressed();
00102 void tabChanged();
00103 void autoScale();
00104 void choosePressed();
00105 void gridSelected();
00106 void show();
00107 void applySplit();
00108
00109 protected slots:
00110
00111 void gridTransparencyChanged();
00112 void customColorTransparencyChanged();
00113 void changeDrawingModeTransparencyChanged();
00114 void splitMethodChanged();
00115 void normalizationChanged();
00116
00117 protected:
00118
00119 ModifyRepresentationDialog(const ModifyRepresentationDialog& dialog);
00120
00121 typedef HashGrid3<const Atom*> AtomGrid;
00122 typedef HashGridBox3<const Atom*> AtomBox;
00123 void colorByCustomColor_();
00124 bool colorByGrid_();
00125 bool insertGrid_(RegularData3D& grid, const String& name);
00126 void removeGrid_(RegularData3D& grid);
00127 void setColor_(ColorRGBA& color, const QLabel* label, const QSpinBox* box);
00128 void getColor_(const ColorRGBA& color, QLabel* label, QSpinBox* box);
00129 void invalidateGrid_();
00130 void invalidateMesh_();
00131 void changeDrawingMode_();
00132 void checkApplyButton_();
00133
00134 void calculateIncludedVertices_(vector<bool>& include_vertex, const Mesh& org_mesh, HashSet<const Composite*>& roots);
00135 inline bool checkInclude_(const AtomGrid& atom_grid, const Vector3& point) const;
00136
00137 RegularData3D* grid_;
00138 float min_value_;
00139 float mid_value_;
00140 float max_value_;
00141 float square_distance_;
00142
00143 ColorRGBA selected_color, min_min_color, min_color, mid_color, max_color, max_max_color;
00144
00145 Representation* rep_;
00146 List<RegularData3D*> grid_list_;
00147 vector<Vector3> vertices_;
00148 MaterialSettings* material_settings_;
00149 };
00150
00151 }
00152 }
00153
00154 #endif