Skip to content

Commit

Permalink
Contour-Lines: added missing files & added docu
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldsteinlechner committed Jan 25, 2024
1 parent fe7260c commit 6416a11
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 0 deletions.
Empty file added docs/Contour-Lines.md
Empty file.
Binary file added docs/contour0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contour1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contourTeaser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/multitexture-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions provex/index.html

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/PRo3D.Core/VisualizationAndTFApp.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace PRo3D.Core

open Adaptify.FSharp
open Aardvark.Base
open PRo3D.Core
open Aardvark.UI
open Aardvark.UI.Primitives
open PRo3D.Base
open FSharp.Data.Adaptive
open PRo3D.Core
open PRo3D.Core.Surface

module ContourLineApp =

type Action =
| SetDistance of Numeric.Action
| SetLineWidth of Numeric.Action
| SetBorder of Numeric.Action
| ToggleEnabled
| SetTargetTexture of Option<TextureLayer>



let update (m : ContourLineModel) (action : Action) =
match action with
| SetDistance a -> { m with distance = Numeric.update m.distance a }
| SetLineWidth a -> { m with width = Numeric.update m.width a }
| SetBorder a -> { m with border = Numeric.update m.border a }
| ToggleEnabled -> { m with enabled = not m.enabled }
| SetTargetTexture a -> { m with targetLayer = a }


let view (model : AdaptiveContourLineModel) =
require GuiEx.semui (
Html.table [
Html.row "" []
Html.row "enabled" [GuiEx.iconCheckBox model.enabled ToggleEnabled]
Html.row "distance: " [Numeric.view' [NumericInputType.Slider; NumericInputType.InputBox] model.distance |> UI.map SetDistance ]
Html.row "width: " [Numeric.view' [NumericInputType.Slider; NumericInputType.InputBox] model.width |> UI.map SetLineWidth ]
Html.row "border: " [Numeric.view' [NumericInputType.Slider; NumericInputType.InputBox] model.border |> UI.map SetBorder ]
]
)
140 changes: 140 additions & 0 deletions src/PRo3D.Core/VisualizationAndTFModel.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
namespace PRo3D.Core

open Adaptify
open Aardvark.Base
open Aardvark.UI
open PRo3D.Base
open Chiron

[<ModelType>]
type ScalarLayer = {
version : int
label : string
actualRange : Range1d
definedRange : Range1d
index : int
colorLegend : FalseColorsModel
}
module ScalarLayer =
let current = 0

let read0 =
json {
let! label = Json.read "label"
let! actualRange = Json.read "actualRange"
let! definedRange = Json.read "definedRange"
let! index = Json.read "index"
let! colorLegend = Json.read "colorLegend"

return
{
version = current
label = label
actualRange = actualRange |> Range1d.Parse
definedRange = definedRange |> Range1d.Parse
index = index
colorLegend = colorLegend
}
}

type ScalarLayer with
static member FromJson(_ : ScalarLayer) =
json {
let! v = Json.read "version"
match v with
| 0 -> return! ScalarLayer.read0
| _ ->
return! v
|> sprintf "don't know version %A of ScalarLayer"
|> Json.error
}
static member ToJson (x : ScalarLayer) =
json {
do! Json.write "version" x.version
do! Json.write "label" x.label
do! Json.write "actualRange" (x.actualRange.ToString())
do! Json.write "definedRange" (x.definedRange.ToString())
do! Json.write "index" x.index
do! Json.write "colorLegend" x.colorLegend
}

type TextureLayer = {
version : int
label : string
index : int
}

module TextureLayer =
let current = 0
let read0 =
json {
let! label = Json.read "label"
let! index = Json.read "index"

return {
version = current
label = label
index = index
}
}

type TextureLayer with
static member FromJson(_ : TextureLayer) =
json {
let! v = Json.read "version"
match v with
| 0 -> return! TextureLayer.read0
| _ ->
return! v
|> sprintf "don't know version %A of TextureLayer"
|> Json.error
}
static member ToJson (x : TextureLayer) =
json {
do! Json.write "version" x.version
do! Json.write "label" x.label
do! Json.write "index" x.index
}

type AttributeLayer =
| ScalarLayer of ScalarLayer
| TextureLayer of TextureLayer

[<ModelType>]
type ContourLineModel =
{
enabled : bool
targetLayer : Option<TextureLayer>
distance : NumericInput
width : NumericInput
border : NumericInput
}

module ContourLineModel =

let initial =
{
enabled = false
distance = {
value = 0
min = 0.0
max = 100.0
step = 0.0001
format = "{0:0.0000}"
}
width = {
value = 0.01
min = 0.0
max = 10.0
step = 0.0001
format = "{0:0.0000}"
}
border = {
value = 0.01
min = 0.0
max = 10.0
step = 0.0001
format = "{0:0.0000}"
}
targetLayer = None
}

0 comments on commit 6416a11

Please sign in to comment.