54 return mLineWidthUnit;
64 QDomElement elem = doc.createElement( QStringLiteral(
"mesh-settings" ) );
65 elem.setAttribute( QStringLiteral(
"enabled" ), mEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
66 elem.setAttribute( QStringLiteral(
"line-width" ), mLineWidth );
74 mEnabled = elem.attribute( QStringLiteral(
"enabled" ) ).toInt();
75 mLineWidth = elem.attribute( QStringLiteral(
"line-width" ) ).toDouble();
83 return mColorRampShader;
88 mColorRampShader = shader;
97 mClassificationMinimum = minimum;
98 mClassificationMaximum = maximum;
107 return mDataResamplingMethod;
112 mDataResamplingMethod = dataInterpolationMethod;
118 QDomElement elem = doc.createElement( QStringLiteral(
"scalar-settings" ) );
119 elem.setAttribute( QStringLiteral(
"min-val" ), mClassificationMinimum );
120 elem.setAttribute( QStringLiteral(
"max-val" ), mClassificationMaximum );
121 elem.setAttribute( QStringLiteral(
"opacity" ), mOpacity );
124 switch ( mDataResamplingMethod )
127 methodTxt = QStringLiteral(
"none" );
130 methodTxt = QStringLiteral(
"neighbour-average" );
133 elem.setAttribute( QStringLiteral(
"interpolation-method" ), methodTxt );
134 QDomElement elemShader = mColorRampShader.
writeXml( doc );
135 elem.appendChild( elemShader );
137 QDomElement elemEdge = doc.createElement( QStringLiteral(
"edge-settings" ) );
138 elemEdge.appendChild( mEdgeStrokeWidth.
writeXml( doc, readWriteContext ) );
139 elemEdge.setAttribute( QStringLiteral(
"stroke-width-unit" ), mEdgeStrokeWidthUnit );
140 elem.appendChild( elemEdge );
148 mClassificationMinimum = elem.attribute( QStringLiteral(
"min-val" ) ).toDouble();
149 mClassificationMaximum = elem.attribute( QStringLiteral(
"max-val" ) ).toDouble();
150 mOpacity = elem.attribute( QStringLiteral(
"opacity" ) ).toDouble();
152 QString methodTxt = elem.attribute( QStringLiteral(
"interpolation-method" ) );
153 if ( QStringLiteral(
"neighbour-average" ) == methodTxt )
155 mDataResamplingMethod = DataResamplingMethod::NeighbourAverage;
159 mDataResamplingMethod = DataResamplingMethod::None;
161 QDomElement elemShader = elem.firstChildElement( QStringLiteral(
"colorrampshader" ) );
162 mColorRampShader.
readXml( elemShader );
164 QDomElement elemEdge = elem.firstChildElement( QStringLiteral(
"edge-settings" ) );
165 QDomElement elemEdgeStrokeWidth = elemEdge.firstChildElement( QStringLiteral(
"mesh-stroke-width" ) );
166 mEdgeStrokeWidth.
readXml( elemEdgeStrokeWidth, readWriteContext );
168 elemEdge.attribute( QStringLiteral(
"stroke-width-unit" ) ).toInt() );
173 return mEdgeStrokeWidth;
178 mEdgeStrokeWidth = strokeWidth;
183 return mEdgeStrokeWidthUnit;
210 mColor = vectorColor;
220 mFilterMin = vectorFilterMin;
230 mFilterMax = vectorFilterMax;
235 return mOnUserDefinedGrid;
240 mOnUserDefinedGrid = enabled;
245 return mUserGridCellWidth;
250 mUserGridCellWidth = width;
255 return mUserGridCellHeight;
260 mUserGridCellHeight = height;
265 return mShaftLengthMethod;
275 return mMinShaftLength;
285 return mMaxShaftLength;
305 return mFixedShaftLength;
315 return mArrowHeadWidthRatio;
320 mArrowHeadWidthRatio = vectorHeadWidthRatio;
325 return mArrowHeadLengthRatio;
330 mArrowHeadLengthRatio = vectorHeadLengthRatio;
335 QDomElement elem = doc.createElement( QStringLiteral(
"vector-arrow-settings" ) );
336 elem.setAttribute( QStringLiteral(
"arrow-head-width-ratio" ), mArrowHeadWidthRatio );
337 elem.setAttribute( QStringLiteral(
"arrow-head-length-ratio" ), mArrowHeadLengthRatio );
339 QDomElement elemShaft = doc.createElement( QStringLiteral(
"shaft-length" ) );
341 switch ( mShaftLengthMethod )
344 methodTxt = QStringLiteral(
"minmax" );
345 elemShaft.setAttribute( QStringLiteral(
"min" ), mMinShaftLength );
346 elemShaft.setAttribute( QStringLiteral(
"max" ), mMaxShaftLength );
349 methodTxt = QStringLiteral(
"scaled" );
350 elemShaft.setAttribute( QStringLiteral(
"scale-factor" ), mScaleFactor );
353 methodTxt = QStringLiteral(
"fixed" ) ;
354 elemShaft.setAttribute( QStringLiteral(
"fixed-length" ), mFixedShaftLength );
357 elemShaft.setAttribute( QStringLiteral(
"method" ), methodTxt );
358 elem.appendChild( elemShaft );
364 mArrowHeadWidthRatio = elem.attribute( QStringLiteral(
"arrow-head-width-ratio" ) ).toDouble();
365 mArrowHeadLengthRatio = elem.attribute( QStringLiteral(
"arrow-head-length-ratio" ) ).toDouble();
367 QDomElement elemShaft = elem.firstChildElement( QStringLiteral(
"shaft-length" ) );
368 QString methodTxt = elemShaft.attribute( QStringLiteral(
"method" ) );
369 if ( QStringLiteral(
"minmax" ) == methodTxt )
371 mShaftLengthMethod =
MinMax;
372 mMinShaftLength = elemShaft.attribute( QStringLiteral(
"min" ) ).toDouble();
373 mMaxShaftLength = elemShaft.attribute( QStringLiteral(
"max" ) ).toDouble();
375 else if ( QStringLiteral(
"scaled" ) == methodTxt )
377 mShaftLengthMethod =
Scaled;
378 mScaleFactor = elemShaft.attribute( QStringLiteral(
"scale-factor" ) ).toDouble();
382 mShaftLengthMethod =
Fixed;
383 mFixedShaftLength = elemShaft.attribute( QStringLiteral(
"fixed-length" ) ).toDouble();
398 return mAveragingMethod.get();
404 mAveragingMethod.reset( method->
clone() );
406 mAveragingMethod.reset();
411 QDomElement elem = doc.createElement( QStringLiteral(
"mesh-renderer-settings" ) );
413 QDomElement elemActiveDatasetGroup = doc.createElement( QStringLiteral(
"active-dataset-group" ) );
414 elemActiveDatasetGroup.setAttribute( QStringLiteral(
"scalar" ), mActiveScalarDatasetGroup );
415 elemActiveDatasetGroup.setAttribute( QStringLiteral(
"vector" ), mActiveVectorDatasetGroup );
416 elem.appendChild( elemActiveDatasetGroup );
418 for (
int groupIndex : mRendererScalarSettings.keys() )
422 elemScalar.setAttribute( QStringLiteral(
"group" ), groupIndex );
423 elem.appendChild( elemScalar );
426 for (
int groupIndex : mRendererVectorSettings.keys() )
430 elemVector.setAttribute( QStringLiteral(
"group" ), groupIndex );
431 elem.appendChild( elemVector );
434 QDomElement elemNativeMesh = mRendererNativeMeshSettings.
writeXml( doc );
435 elemNativeMesh.setTagName( QStringLiteral(
"mesh-settings-native" ) );
436 elem.appendChild( elemNativeMesh );
438 QDomElement elemEdgeMesh = mRendererEdgeMeshSettings.
writeXml( doc );
439 elemEdgeMesh.setTagName( QStringLiteral(
"mesh-settings-edge" ) );
440 elem.appendChild( elemEdgeMesh );
442 QDomElement elemTriangularMesh = mRendererTriangularMeshSettings.
writeXml( doc );
443 elemTriangularMesh.setTagName( QStringLiteral(
"mesh-settings-triangular" ) );
444 elem.appendChild( elemTriangularMesh );
446 if ( mAveragingMethod )
448 QDomElement elemAveraging = doc.createElement( QStringLiteral(
"averaging-3d" ) );
449 elemAveraging.setAttribute( QStringLiteral(
"method" ), QStringLiteral(
"%1" ).arg( mAveragingMethod->method() ) ) ;
450 QDomElement elemAveragingParams = mAveragingMethod->writeXml( doc );
451 elemAveraging.appendChild( elemAveragingParams );
452 elem.appendChild( elemAveraging );
460 mRendererScalarSettings.clear();
461 mRendererVectorSettings.clear();
462 mAveragingMethod.reset();
464 QDomElement elemActiveDataset = elem.firstChildElement( QStringLiteral(
"active-dataset-group" ) );
465 if ( elemActiveDataset.hasAttribute( QStringLiteral(
"scalar" ) ) )
466 mActiveScalarDatasetGroup = elemActiveDataset.attribute( QStringLiteral(
"scalar" ) ).toInt();
468 if ( elemActiveDataset.hasAttribute( QStringLiteral(
"vector" ) ) )
469 mActiveVectorDatasetGroup = elemActiveDataset.attribute( QStringLiteral(
"vector" ) ).toInt();
471 QDomElement elemScalar = elem.firstChildElement( QStringLiteral(
"scalar-settings" ) );
472 while ( !elemScalar.isNull() )
474 int groupIndex = elemScalar.attribute( QStringLiteral(
"group" ) ).toInt();
479 elemScalar = elemScalar.nextSiblingElement( QStringLiteral(
"scalar-settings" ) );
482 QDomElement elemVector = elem.firstChildElement( QStringLiteral(
"vector-settings" ) );
483 while ( !elemVector.isNull() )
485 int groupIndex = elemVector.attribute( QStringLiteral(
"group" ) ).toInt();
490 elemVector = elemVector.nextSiblingElement( QStringLiteral(
"vector-settings" ) );
493 QDomElement elemNativeMesh = elem.firstChildElement( QStringLiteral(
"mesh-settings-native" ) );
494 mRendererNativeMeshSettings.
readXml( elemNativeMesh );
496 QDomElement elemEdgeMesh = elem.firstChildElement( QStringLiteral(
"mesh-settings-edge" ) );
497 mRendererEdgeMeshSettings.
readXml( elemEdgeMesh );
499 QDomElement elemTriangularMesh = elem.firstChildElement( QStringLiteral(
"mesh-settings-triangular" ) );
500 mRendererTriangularMeshSettings.
readXml( elemTriangularMesh );
502 QDomElement elemAveraging = elem.firstChildElement( QStringLiteral(
"averaging-3d" ) );
503 if ( !elemAveraging.isNull() )
511 return mActiveScalarDatasetGroup;
521 return mActiveVectorDatasetGroup;
531 return mSeedingMethod;
541 return mSeedingDensity;
551 QDomElement elem = doc.createElement( QStringLiteral(
"vector-streamline-settings" ) );
553 elem.setAttribute( QStringLiteral(
"seeding-method" ), mSeedingMethod );
554 elem.setAttribute( QStringLiteral(
"seeding-density" ), mSeedingDensity );
563 elem.attribute( QStringLiteral(
"seeding-method" ) ).toInt() );
564 mSeedingDensity = elem.attribute( QStringLiteral(
"seeding-density" ) ).toDouble();
569 return mDisplayingMethod;
574 mDisplayingMethod = displayingMethod;
579 return mArrowsSettings;
589 return mStreamLinesSettings;
599 QDomElement elem = doc.createElement( QStringLiteral(
"vector-settings" ) );
600 elem.setAttribute( QStringLiteral(
"symbology" ), mDisplayingMethod );
602 elem.setAttribute( QStringLiteral(
"line-width" ), mLineWidth );
603 elem.setAttribute( QStringLiteral(
"coloring-method" ),
coloringMethod() );
605 QDomElement elemShader = mColorRampShader.
writeXml( doc );
606 elem.appendChild( elemShader );
607 elem.setAttribute( QStringLiteral(
"filter-min" ), mFilterMin );
608 elem.setAttribute( QStringLiteral(
"filter-max" ), mFilterMax );
610 elem.setAttribute( QStringLiteral(
"user-grid-enabled" ), mOnUserDefinedGrid ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
611 elem.setAttribute( QStringLiteral(
"user-grid-width" ), mUserGridCellWidth );
612 elem.setAttribute( QStringLiteral(
"user-grid-height" ), mUserGridCellHeight );
614 elem.appendChild( mArrowsSettings.
writeXml( doc ) );
615 elem.appendChild( mStreamLinesSettings.
writeXml( doc ) );
616 elem.appendChild( mTracesSettings.
writeXml( doc ) );
624 elem.attribute( QStringLiteral(
"symbology" ) ).toInt() );
626 mLineWidth = elem.attribute( QStringLiteral(
"line-width" ) ).toDouble();
628 elem.attribute( QStringLiteral(
"coloring-method" ) ).toInt() );
630 mColorRampShader.
readXml( elem.firstChildElement(
"colorrampshader" ) );
631 mFilterMin = elem.attribute( QStringLiteral(
"filter-min" ) ).toDouble();
632 mFilterMax = elem.attribute( QStringLiteral(
"filter-max" ) ).toDouble();
634 mOnUserDefinedGrid = elem.attribute( QStringLiteral(
"user-grid-enabled" ) ).toInt();
635 mUserGridCellWidth = elem.attribute( QStringLiteral(
"user-grid-width" ) ).toInt();
636 mUserGridCellHeight = elem.attribute( QStringLiteral(
"user-grid-height" ) ).toInt();
638 QDomElement elemVector = elem.firstChildElement( QStringLiteral(
"vector-arrow-settings" ) );
639 if ( ! elemVector.isNull() )
640 mArrowsSettings.
readXml( elemVector );
642 QDomElement elemStreamLine = elem.firstChildElement( QStringLiteral(
"vector-streamline-settings" ) );
643 if ( ! elemStreamLine.isNull() )
644 mStreamLinesSettings.
readXml( elemStreamLine );
646 QDomElement elemTraces = elem.firstChildElement( QStringLiteral(
"vector-traces-settings" ) );
647 if ( ! elemTraces.isNull() )
648 mTracesSettings.
readXml( elemTraces );
653 return mColoringMethod;
663 return mColorRampShader;
674 switch ( mColoringMethod )
684 return strokeColoring;
689 return mTracesSettings;
699 mMaximumTailLength = elem.attribute( QStringLiteral(
"maximum-tail-length" ) ).toInt();
701 elem.attribute( QStringLiteral(
"maximum-tail-length-unit" ) ).toInt() );
702 mParticlesCount = elem.attribute( QStringLiteral(
"particles-count" ) ).toInt();
707 QDomElement elem = doc.createElement( QStringLiteral(
"vector-traces-settings" ) );
708 elem.setAttribute( QStringLiteral(
"maximum-tail-length" ), mMaximumTailLength );
709 elem.setAttribute( QStringLiteral(
"maximum-tail-length-unit" ), mMaximumTailLengthUnit );
710 elem.setAttribute( QStringLiteral(
"particles-count" ), mParticlesCount );
717 return mMaximumTailLengthUnit;
727 return mMaximumTailLength;
737 return mParticlesCount;
742 mParticlesCount = value;