Skip to content

Commit

Permalink
rename withAnnotatedLabels to withSvgHighlighting (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellussiegburg committed Jul 4, 2024
1 parent a24f478 commit a532bb8
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 33 deletions.
2 changes: 2 additions & 0 deletions example/src/Modelling/ActivityDiagram/MatchPetri/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ task39 = MatchPetriConfig {
maxInstances = Just 10000,
hideBranchConditions = True,
petriLayout = [Fdp],
petriSvgHighlighting = True,
supportSTAbsent = Nothing,
activityFinalsExist = Just False,
avoidAddingSinksForFinals = Nothing,
Expand Down Expand Up @@ -54,6 +55,7 @@ task40 = MatchPetriConfig {
maxInstances = Just 2000,
hideBranchConditions = True,
petriLayout = [Fdp],
petriSvgHighlighting = True,
supportSTAbsent = Nothing,
activityFinalsExist = Just False,
avoidAddingSinksForFinals = Nothing,
Expand Down
2 changes: 2 additions & 0 deletions example/src/Modelling/ActivityDiagram/SelectPetri/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ task37 = SelectPetriConfig {
hideBranchConditions = True,
hidePetriNodeLabels = False,
petriLayout = [Fdp],
petriSvgHighlighting = True,
numberOfWrongAnswers = 5,
numberOfModifications = 3,
modifyAtMid = True,
Expand Down Expand Up @@ -59,6 +60,7 @@ task38 = SelectPetriConfig {
hideBranchConditions = True,
hidePetriNodeLabels = True,
petriLayout = [Dot],
petriSvgHighlighting = True,
numberOfWrongAnswers = 5,
numberOfModifications = 3,
modifyAtMid = True,
Expand Down
10 changes: 5 additions & 5 deletions src/Modelling/ActivityDiagram/MatchPetri.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ data MatchPetriConfig = MatchPetriConfig {
adConfig :: AdConfig,
maxInstances :: Maybe Integer,
hideBranchConditions :: Bool,
-- | Enable putting label information inside generated SVGs
petriAnnotatedLabels :: Bool,
petriLayout :: [GraphvizCommand],
-- | Whether highlighting on hover should be enabled
petriSvgHighlighting :: Bool,
-- | Option to prevent support STs from occurring

Check failure on line 122 in src/Modelling/ActivityDiagram/MatchPetri.hs

View workflow job for this annotation

GitHub Actions / Check Spelling

`STs` is not a recognized word. (unrecognized-spelling)
supportSTAbsent :: Maybe Bool,
-- | Option to disallow activity finals to reduce semantic confusion
Expand All @@ -138,8 +138,8 @@ defaultMatchPetriConfig = MatchPetriConfig
{ adConfig = defaultAdConfig {activityFinalNodes = 0, flowFinalNodes = 2},
maxInstances = Just 25,
hideBranchConditions = False,
petriAnnotatedLabels = False,
petriLayout = [Dot],
petriSvgHighlighting = True,
supportSTAbsent = Nothing,
activityFinalsExist = Just False,
avoidAddingSinksForFinals = Nothing,
Expand Down Expand Up @@ -426,8 +426,8 @@ getMatchPetriTask config = do
},
petriDrawConf =
DrawSettings {
withAnnotatedLabels = petriAnnotatedLabels config,
withPlaceNames = True,
withSvgHighlighting = petriSvgHighlighting config,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = layout
Expand Down Expand Up @@ -887,8 +887,8 @@ defaultMatchPetriInstance = MatchPetriInstance
, plantUMLConf = defaultPlantUmlConfig
, petriDrawConf =
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Dot
Expand Down
10 changes: 5 additions & 5 deletions src/Modelling/ActivityDiagram/SelectPetri.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ data SelectPetriConfig = SelectPetriConfig {
hideNodeNames :: Bool,
hideBranchConditions :: Bool,
hidePetriNodeLabels :: Bool,
-- | Enable putting label information inside generated SVGs
petriAnnotatedLabels :: Bool,
petriLayout :: [GraphvizCommand],
-- | Whether highlighting on hover should be enabled
petriSvgHighlighting :: Bool,
numberOfWrongAnswers :: Int,
numberOfModifications :: Int,
modifyAtMid :: Bool,
Expand All @@ -150,8 +150,8 @@ defaultSelectPetriConfig = SelectPetriConfig {
hideNodeNames = False,
hideBranchConditions = False,
hidePetriNodeLabels = False,
petriAnnotatedLabels = False,
petriLayout = [Dot],
petriSvgHighlighting = True,
numberOfWrongAnswers = 2,
numberOfModifications = 3,
modifyAtMid = True,
Expand Down Expand Up @@ -427,8 +427,8 @@ getSelectPetriTask config = do
suppressBranchConditions = hideBranchConditions config
}
petriDrawConf = DrawSettings {
withAnnotatedLabels = petriAnnotatedLabels config,
withPlaceNames = not $ hidePetriNodeLabels config,
withSvgHighlighting = petriSvgHighlighting config,
withTransitionNames = not $ hidePetriNodeLabels config,
with1Weights = False,
withGraphvizCommand = layout
Expand Down Expand Up @@ -500,8 +500,8 @@ defaultSelectPetriInstance = SelectPetriInstance {
},
plantUMLConf = defaultPlantUmlConfig,
petriDrawConf = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Dot
Expand Down
8 changes: 4 additions & 4 deletions src/Modelling/PetriNet/Concurrency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ findConcurrencyGenerate config segment seed = flip evalRandT (mkStdGen seed) $ d
c
return $ FindInstance {
drawFindWith = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = not $ hidePlaceNames gc,
withSvgHighlighting = True,
withTransitionNames = not $ hideTransitionNames gc,
with1Weights = not $ hideWeight1 gc,
withGraphvizCommand = gl
Expand Down Expand Up @@ -519,8 +519,8 @@ defaultPickConcurrencyInstance = PickInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = False,
with1Weights = False,
withGraphvizCommand = Fdp
Expand All @@ -539,8 +539,8 @@ defaultPickConcurrencyInstance = PickInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = False,
with1Weights = False,
withGraphvizCommand = Fdp
Expand All @@ -553,8 +553,8 @@ defaultPickConcurrencyInstance = PickInstance {
defaultFindConcurrencyInstance :: FindInstance SimplePetriNet (Concurrent Transition)
defaultFindConcurrencyInstance = FindInstance {
drawFindWith = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Circo
Expand Down
8 changes: 4 additions & 4 deletions src/Modelling/PetriNet/Conflict.hs
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ findConflictGenerate config segment seed = flip evalRandT (mkStdGen seed) $ do
$ toPetriConflict c
return $ FindInstance {
drawFindWith = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = not $ hidePlaceNames gc,
withSvgHighlighting = True,
withTransitionNames = not $ hideTransitionNames gc,
with1Weights = not $ hideWeight1 gc,
withGraphvizCommand = gl
Expand Down Expand Up @@ -680,8 +680,8 @@ defaultPickConflictInstance = PickInstance {
("t3",SimpleTransition {flowOut = M.empty})]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = False,
with1Weights = False,
withGraphvizCommand = Fdp
Expand All @@ -699,8 +699,8 @@ defaultPickConflictInstance = PickInstance {
("t3",SimpleTransition {flowOut = M.empty})]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = False,
with1Weights = False,
withGraphvizCommand = Fdp
Expand All @@ -713,8 +713,8 @@ defaultPickConflictInstance = PickInstance {
defaultFindConflictInstance :: FindInstance SimplePetriNet Conflict
defaultFindConflictInstance = FindInstance {
drawFindWith = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = False,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Circo
Expand Down
2 changes: 1 addition & 1 deletion src/Modelling/PetriNet/ConflictPlaces.hs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ prohibitHidePlaceNames gc
defaultFindConflictPlacesInstance :: FindInstance SimplePetriNet Conflict
defaultFindConflictPlacesInstance = FindInstance {
drawFindWith = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Circo
Expand Down
10 changes: 5 additions & 5 deletions src/Modelling/PetriNet/Diagram.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ cacheNet path labelOf pl drawSettings@DrawSettings {..} =
ext = short withPlaceNames
++ short withTransitionNames
++ short with1Weights
++ short withAnnotatedLabels
++ short withSvgHighlighting
++ short withGraphvizCommand
++ ".svg"

Expand Down Expand Up @@ -197,8 +197,8 @@ drawNode DrawSettings {..} preparedFont (l, Nothing) p = place
p
where
additionalLabel
| withAnnotatedLabels = svgClass $ ' ' : l
| otherwise = id
| withSvgHighlighting = id
| otherwise = svgClass $ ' ' : l
addTransitionName
| not withTransitionNames = id
| otherwise = (center (text' preparedFont 18 l) `atop`)
Expand All @@ -215,8 +215,8 @@ drawNode DrawSettings {..} preparedFont (l, Just i) p
p
where
additionalLabel
| withAnnotatedLabels = svgClass $ ' ' : l
| otherwise = id
| withSvgHighlighting = id
| otherwise = svgClass $ ' ' : l
spacer = 9
emptyPlace = circle 20 # lwL 0.5 # named l # svgClass "node" # additionalLabel
label
Expand Down
10 changes: 5 additions & 5 deletions src/Modelling/PetriNet/MatchToMath.hs
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,8 @@ defaultGraphToMathInstance = MatchInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Sfdp
Expand Down Expand Up @@ -723,8 +723,8 @@ defaultMathToGraphInstance = MatchInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Dot
Expand All @@ -743,8 +743,8 @@ defaultMathToGraphInstance = MatchInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Sfdp
Expand All @@ -763,8 +763,8 @@ defaultMathToGraphInstance = MatchInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Circo}
Expand All @@ -782,8 +782,8 @@ defaultMathToGraphInstance = MatchInstance {
]
},
DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = True,
with1Weights = False,
withGraphvizCommand = Fdp
Expand Down
2 changes: 1 addition & 1 deletion src/Modelling/PetriNet/Reach/Draw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ drawToFile hidePlaceNames path cmd x net = cacheNet
id
(toPetriLike show show net)
DrawSettings {
withAnnotatedLabels = False,
with1Weights = False,
withPlaceNames = not hidePlaceNames,
withSvgHighlighting = True,
withTransitionNames = True,
withGraphvizCommand = cmd
}
Expand Down
4 changes: 2 additions & 2 deletions src/Modelling/PetriNet/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ defaultPickConcurrencyConfig = PickConcurrencyConfig
}

data DrawSettings = DrawSettings {
withAnnotatedLabels :: Bool,
withPlaceNames :: Bool,
withSvgHighlighting :: Bool,
withTransitionNames :: Bool,
with1Weights :: Bool,
withGraphvizCommand :: GraphvizCommand
Expand All @@ -894,8 +894,8 @@ type Drawable n = (n, DrawSettings)

drawSettingsWithCommand :: GraphConfig -> GraphvizCommand -> DrawSettings
drawSettingsWithCommand config c = DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = not $ hidePlaceNames config,
withSvgHighlighting = True,
withTransitionNames = not $ hideTransitionNames config,
with1Weights = not $ hideWeight1 config,
withGraphvizCommand = c
Expand Down
2 changes: 1 addition & 1 deletion test/Modelling/PetriNet/DiagramSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ spec =
(petriNetRnd defaultBasicConfig defaultAdvConfig)
pl <- parseNet "flow" "tokens" inst
dia <- drawNet show (pl :: SimplePetriLike Object) DrawSettings {
withAnnotatedLabels = False,
withPlaceNames = True,
withSvgHighlighting = True,
withTransitionNames = False,
with1Weights = False,
withGraphvizCommand = TwoPi
Expand Down

0 comments on commit a532bb8

Please sign in to comment.