Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Thompson
SMTK
Commits
8ff0325e
Commit
8ff0325e
authored
Dec 14, 2015
by
Yumin Yuan
Browse files
Made discrete write-op to be like write-ops in other sessions
parent
80683af9
Changes
2
Hide whitespace changes
Inline
Side-by-side
smtk/bridge/discrete/operators/WriteOperator.cxx
View file @
8ff0325e
...
...
@@ -49,14 +49,15 @@ WriteOperator::WriteOperator()
bool
WriteOperator
::
ableToOperate
()
{
smtk
::
model
::
Model
model
;
smtk
::
model
::
Models
models
=
this
->
specification
()
->
associatedModelEntities
<
smtk
::
model
::
Models
>
();
bool
able2Op
=
this
->
ensureSpecification
()
&&
// The SMTK model must be valid
(
model
=
this
->
specification
()
->
findModelEntity
(
"model"
)
->
value
().
as
<
smtk
::
model
::
Model
>
()).
isValid
()
&&
(
models
.
size
()
>
0
&&
models
[
0
].
isValid
()
&&
// The CMB model must exist
this
->
discreteSession
()
->
findModelEntity
(
model
.
entity
());
this
->
discreteSession
()
->
findModelEntity
(
model
s
[
0
]
.
entity
())
)
;
if
(
!
able2Op
)
return
false
;
...
...
@@ -74,8 +75,12 @@ OperatorResult WriteOperator::operateInternal()
Session
*
opsession
=
this
->
discreteSession
();
// ableToOperate should have verified that the model exists
smtk
::
model
::
Model
model
=
this
->
specification
()
->
findModelEntity
(
"model"
)
->
value
().
as
<
smtk
::
model
::
Model
>
();
smtk
::
model
::
Models
models
=
this
->
specification
()
->
associatedModelEntities
<
smtk
::
model
::
Models
>
();
if
(
models
.
size
()
==
0
)
return
this
->
createResult
(
OPERATION_FAILED
);
smtk
::
model
::
Model
model
=
models
[
0
];
vtkDiscreteModelWrapper
*
modelWrapper
=
opsession
->
findModelEntity
(
model
.
entity
());
...
...
smtk/bridge/discrete/operators/WriteOperator.sbt
View file @
8ff0325e
...
...
@@ -4,10 +4,15 @@
<
Definitions
>
<!--
Operator
-->
<
AttDef
Type
=
"write"
BaseType
=
"operator"
>
<
AssociationsDef
Name
=
"Model"
NumberOfRequiredValues
=
"1"
>
<
MembershipMask
>
model
</
MembershipMask
>
</
AssociationsDef
>
<
ItemDefinitions
>
<!--
<
ModelEntity
Name
=
"model"
NumberOfRequiredValues
=
"1"
>
<
MembershipMask
>
model
</
MembershipMask
>
</
ModelEntity
>
-->
<
File
Name
=
"filename"
NumberOfRequiredValues
=
"1"
ShouldExist
=
"false"
FileFilters
=
"Conceptual Model Builder (*.cmb)"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment