@@ -49,10 +49,12 @@ type PropertyDef =
4949 | VectorProperty of CircleProps
5050
5151let grey = " #848484"
52- let propertiesDef = Map.ofSeq [
53- " edgeColorGrey" , EdgeProperty ( PolylineProps.Color grey)
54- " nodeColorGrey" , VectorProperty ( CircleProps.Color grey)
55- ]
52+ let mkProperties = List.choose ( fun ( s : string ) -> s.Split '=' |> Array.toList |> function
53+ | [ " edgeColorGrey" ; " " ] -> EdgeProperty ( PolylineProps.Color grey) |> Some
54+ | [ " nodeColorGrey" ; " " ] -> VectorProperty ( CircleProps.Color grey) |> Some
55+ | [ " radius" ; r] -> VectorProperty ( CircleProps.Radius ( float r)) |> Some
56+ | _ -> None)
57+
5658
5759let nl = System.Environment.NewLine
5860let tryInt ( s : string ) = let ( r , x ) = System.Int32.TryParse s in if r then Some x else None
@@ -268,17 +270,18 @@ let view model dispatch =
268270 |> Seq.map ( fun x ->
269271 let extraProps =
270272 x.Properties
271- |> List.choose ( fun p -> Map.tryFind p propertiesDef )
273+ |> mkProperties
272274 |> List.choose ( function | VectorProperty p -> Some p | _ -> None)
273- ReactLeaflet.circle ([
275+ ReactLeaflet.circle ( extraProps @ [
274276 CircleProps.Custom ( " center" , (!^ ( x.Longitude, x.Latitude): Leaflet.LatLngExpression))
275- CircleProps.Radius ( zoomDynSize ( onScaleSqrt 200. 800. ( getNumberOfLinesFactor x)))
277+ if extraProps |> Seq.exists ( function | CircleProps.Radius _ -> true | _ -> false ) |> not then
278+ CircleProps.Radius ( zoomDynSize ( onScaleSqrt 200. 800. ( getNumberOfLinesFactor x)))
276279 CircleProps.Color ( getColor x.Weight)
277280 CircleProps.Opacity ( opacity x)
278281 // MarkerProps.Title x.Title
279282 //CircleProps.OnMouseOver (fun _ -> printfn "hover %s" x.Title)
280283 //CircleProps.OnMouseOut (fun _ -> printfn "hover off %s" x.Title)
281- ] @ extraProps ) [ ReactLeaflet.popup [] [ getTitle x.Title]; ReactLeaflet.tooltip [ TooltipProps.Sticky true ] [ getTitle x.Title] ]
284+ ]) [ ReactLeaflet.popup [] [ getTitle x.Title]; ReactLeaflet.tooltip [ TooltipProps.Sticky true ] [ getTitle x.Title] ]
282285 )
283286 let edges =
284287 let opacity ( x , y ) = ( opacity x + opacity y) / 2.
@@ -288,7 +291,7 @@ let view model dispatch =
288291 let opacity = PolylineProps.Opacity ( opacity ( x, y))
289292 let extraProps =
290293 x.Properties @ y.Properties
291- |> List.choose ( fun p -> Map.tryFind p propertiesDef )
294+ |> mkProperties
292295 |> List.choose ( function | EdgeProperty p -> Some p | _ -> None)
293296 let line =
294297 ReactLeaflet.polyline ([
@@ -359,7 +362,7 @@ let view model dispatch =
359362 let loadDataView () =
360363 Columns.columns [] [
361364 Column.column [] [
362- str " Data format (delimeter TAB): location | GPS(lat,lng) | year | name | note | type"
365+ str " Data format (delimeter TAB): location | GPS(lat,lng) | year | name | note | type | properties "
363366 textarea [
364367 DefaultValue model.RawData
365368 OnChange ( fun ev -> (!! ev.target?value) |> SetRawData |> dispatch)
0 commit comments