Skip to content

Commit

Permalink
Merge c1a450a into 46dcd71
Browse files Browse the repository at this point in the history
  • Loading branch information
LafCorentin committed Sep 2, 2020
2 parents 46dcd71 + c1a450a commit 593ddf2
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -911,12 +911,12 @@ if(USE_PREBUILT_QTWEBKIT_PACKAGE)
editing/CellMLAnnotationView
editing/CellMLEditingView
editing/CellMLTextView
editing/CellMLZincMappingView
editing/EditingView
editing/RawCellMLView
editing/RawSEDMLView
editing/RawTextView
editing/SEDMLEditingView
editing/CellMLZincMappingView

miscellaneous/Compiler
miscellaneous/Core
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ CellMLZincMappingViewEditingWidget::CellMLZincMappingViewEditingWidget(const QSt
mClearNode = Core::newAction(QIcon(":/oxygen/actions/edit-clear.png"),
mToolBarWidget);

mDelayWidget = new QwtWheel(mToolBarWidget);
mDelayWidget->setBorderWidth(0);
mDelayWidget->setFixedSize(int(0.07*availableGeometry.width()),
mDelayWidget->height()/2);
mDelayWidget->setFocusPolicy(Qt::NoFocus);
mDelayWidget->setRange(-30.0, 100.0);
mDelayWidget->setWheelBorderWidth(0);
mDelayWidget->setValue(CellMLZincMappingViewZincWidget::nodeSizeOrigin);
mNodeSizeWidget = new QwtWheel(mToolBarWidget);
mNodeSizeWidget->setBorderWidth(0);
mNodeSizeWidget->setFixedSize(int(0.07*availableGeometry.width()),
mNodeSizeWidget->height()/2);
mNodeSizeWidget->setFocusPolicy(Qt::NoFocus);
mNodeSizeWidget->setRange(-50.0, 100.0);
mNodeSizeWidget->setWheelBorderWidth(0);
mNodeSizeWidget->setValue(CellMLZincMappingViewZincWidget::nodeSizeOrigin);

mToolBarWidget->addAction(mSaveMapping);
mToolBarWidget->addAction(mOpenMeshFile);
mToolBarWidget->addAction(mClearNode);
mToolBarWidget->addWidget(mDelayWidget);
mToolBarWidget->addWidget(mNodeSizeWidget);

mTopSeparator = Core::newLineWidget(this);

Expand Down Expand Up @@ -177,7 +177,7 @@ CellMLZincMappingViewEditingWidget::CellMLZincMappingViewEditingWidget(const QSt

connect(mClearNode, &QAction::triggered,
mZincWidget, &CellMLZincMappingViewZincWidget::eraseNode);
connect(mDelayWidget, &QwtWheel::valueChanged,
connect(mNodeSizeWidget, &QwtWheel::valueChanged,
mZincWidget, &CellMLZincMappingViewZincWidget::setNodeSizes);

mHorizontalSplitterWidget->addWidget(mZincWidget);
Expand Down Expand Up @@ -260,6 +260,13 @@ void CellMLZincMappingViewEditingWidget::eraseNodeValue(const int pId)

//==============================================================================

void CellMLZincMappingViewEditingWidget::setWheelPosition(int pValue)
{
mNodeSizeWidget->setValue(pValue);
}

//==============================================================================

void CellMLZincMappingViewEditingWidget::filePermissionsChanged()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class CellMLZincMappingViewEditingWidget : public Core::Widget
void setNodeValue(const int pId, const QString &pComponent, const QString &pVariable);
void eraseNodeValue(const int pId);

void setWheelPosition(int pValue);

void filePermissionsChanged();

bool setMeshFile(const QString &pFileName, bool pShowWarning = true);
Expand Down Expand Up @@ -129,7 +131,7 @@ class CellMLZincMappingViewEditingWidget : public Core::Widget
QFrame *mTopSeparator;
QFrame *mBottomSeparator;

QwtWheel *mDelayWidget;
QwtWheel *mNodeSizeWidget;

Core::ToolBarWidget *mToolBarWidget;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,18 @@ void CellMLZincMappingViewZincWidget::draw()
sceneViewer().viewAll();
sceneViewer().getLookatPosition(mLookAtPositionOriginal);

// Customise the size of our points

double left, right, bottom, top, nearPlane, farPlane;

sceneViewer().getViewingVolume(&left, &right, &bottom, &top, &nearPlane, &farPlane);

//TODO is it the best way to guess ? Maybe min is more accurate
//TODO is the cast in function below ok ??
int nodeSize= qCeil(qLn(0.0017*qMax(right-left,qMax(top-bottom,farPlane-nearPlane)))*invLnNodeSizeExp);

mEditingWidget->setWheelPosition(nodeSize);
setNodeSizes(nodeSize);
}

//==============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ along with this program. If not, see <https://gnu.org/licenses>.

#include <QFile>
#include <QStandardItemModel>
#include <QtMath>

//==============================================================================

Expand Down Expand Up @@ -63,8 +64,8 @@ class CellMLZincMappingViewZincWidget : public ZincWidget::ZincWidget

void changeSource(const QString &pMainFileName);

static constexpr double nodeSizeOrigin = -6;
static constexpr double nodeSixeExp = 1.1;
static constexpr double nodeSizeOrigin = 0;
static constexpr double nodeSixeExp = 1.1;

public slots:
void setNodeSizes(int pSize);
Expand All @@ -85,6 +86,8 @@ public slots:

private:

double invLnNodeSizeExp = 1/qLn(nodeSixeExp);

QString mMainFileName;
QString mAuxFileName;
QString mCoordinatesName;
Expand Down

0 comments on commit 593ddf2

Please sign in to comment.