Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"jsts": "2.7.1",
"jsuites": "5.9.1",
"monaco-editor": "0.34.0",
"ol": "8.1.0",
"ol-ext": "4.0.11",
"ol": "10.9.0",
"ol-ext": "4.0.38",
"popper.js": "1.16.1",
"proj4": "2.9.1",
"quill": "1.3.7",
Expand Down
4 changes: 3 additions & 1 deletion client/src/main/scala/ch/wsl/box/client/Module.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package ch.wsl.box.client
import ch.wsl.box.client.services.{ClientSession, DataAccessObject, HttpClient, Navigator, Notification, NotificationChannel, NotificationWebSocket, Preferences, REST}
import ch.wsl.box.client.services.{ClientSession, DataAccessObject, HttpClient, Messages, MessagesPropertyImpl, Navigator, Notification, NotificationChannel, NotificationWebSocket, Preferences, REST}
import ch.wsl.box.client.services.impl.{DaoLocalDbImpl, DaoPassthroughImpl, HttpClientImpl, PreferencesImpl, RestImpl}
import ch.wsl.box.client.styles.{BoxStyle, BoxStyleFactory, GlobalStyleFactory}
import ch.wsl.box.client.views.components.{BoxMainLayout, MainLayout}
Expand All @@ -23,6 +23,7 @@ object Module {
.bind[NotificationChannel].to[NotificationWebSocket]
.bind[BoxStyleFactory].to[GlobalStyleFactory]
.bind[MainLayout].to[BoxMainLayout]
.bind[Messages].to[MessagesPropertyImpl]

val prod = newDesign
.bind[HttpClient].to[HttpClientImpl]
Expand All @@ -34,4 +35,5 @@ object Module {
.bind[NotificationChannel].to[NotificationWebSocket]
.bind[BoxStyleFactory].to[GlobalStyleFactory]
.bind[MainLayout].to[BoxMainLayout]
.bind[Messages].to[MessagesPropertyImpl]
}
4 changes: 2 additions & 2 deletions client/src/main/scala/ch/wsl/box/client/geo/MapControls.scala
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ abstract class MapControls(params:MapControlsParams)(implicit ec:ExecutionContex
}
e.preventDefault()
})
)(Icons.target).render
)(Icons.target()).render
}
ttgpsButtonGoTo = tt
el
Expand All @@ -337,7 +337,7 @@ abstract class MapControls(params:MapControlsParams)(implicit ec:ExecutionContex
}
e.preventDefault()
})
)(Icons.target).render
)(Icons.target()).render
}
ttgpsButtonInsert = tt
el
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.wsl.box.client.geo

import ch.wsl.box.client.styles.Icons
import ch.wsl.typings.ol
import ch.wsl.typings.ol.geomMod.Point
import ch.wsl.typings.ol.{controlControlMod, controlMod, geolocationMod, geomGeometryMod, geomMod, imageMod, layerBaseVectorMod, layerMod, mod, renderFeatureMod, sourceMod, sourceVectorMod, styleMod}
Expand Down Expand Up @@ -50,7 +51,7 @@ class MapGeolocation(map:mod.Map) {
}
})

def control = new controlMod.Control(controlControlMod.Options().setElement(div(`class` := "ol-control", style := "top: 10px; right:10px; padding: 1px 6px", input(
def control = div(padding := 3.px,display.flex,justifyContent.spaceAround,alignItems.center, input(
`type`:="checkbox",
onchange :+= {(e:Event) =>
if(e.target.asInstanceOf[HTMLInputElement].checked) {
Expand All @@ -63,7 +64,7 @@ class MapGeolocation(map:mod.Map) {


}
).render ,"GPS").render))
).render,Icons.target(24,24)).render


}
76 changes: 74 additions & 2 deletions client/src/main/scala/ch/wsl/box/client/geo/MapUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ import org.scalajs.dom
import scalatags.JsDom.all.s
import scribe.Logging
import ch.wsl.typings.ol.coordinateMod.Coordinate
import ch.wsl.typings.ol.layerLayerMod.Layer
import ch.wsl.typings.ol.layerTileMod.TileLayer
import ch.wsl.typings.ol.mapBrowserEventMod.MapBrowserEvent
import ch.wsl.typings.ol.{featureMod, formatGeoJSONMod, formatMod, geomGeometryMod, layerBaseMod, layerBaseTileMod, layerMod, mod, projMod, sourceMod, sourceWmtsMod}
import ch.wsl.typings.ol.renderEventMod.RenderEvent
import ch.wsl.typings.ol.styleCircleMod.CircleStyle
import ch.wsl.typings.ol.styleMod.{Circle, Stroke, Style}
import ch.wsl.typings.ol.{featureMod, formatGeoJSONMod, formatMod, geomGeometryMod, layerBaseMod, layerBaseTileMod, layerMod, mod, observableMod, projMod, sourceMod, sourceWmtsMod, styleCircleMod, styleFillMod, styleMod, styleStrokeMod, styleStyleMod}
import org.scalajs.dom.Event

import java.util.UUID
import java.util.{Date, UUID}
import scala.concurrent.Promise
import scala.scalajs.js
import scala.scalajs.js.|._
Expand Down Expand Up @@ -263,6 +269,72 @@ object MapUtils extends Logging {
ol
}

var listenerKey:ch.wsl.typings.ol.eventsMod.EventsKey = null

def stopFlashing() = {
ch.wsl.typings.ol.eventsMod.unlistenByKey(listenerKey)
}

def flash(feature: ch.wsl.typings.ol.featureMod.Feature[_], map: ch.wsl.typings.ol.mod.Map,layer:ch.wsl.typings.ol.layerMod.Vector[_]): Unit = {
val period = 1000
val start = new Date().getTime

val flashGeom = feature.getGeometry().get.asInstanceOf[js.Dynamic].clone().asInstanceOf[ch.wsl.typings.ol.geomMod.Geometry]
val flashGeom2 = feature.getGeometry().get.asInstanceOf[js.Dynamic].clone().asInstanceOf[ch.wsl.typings.ol.geomMod.Geometry]



def animate(event: RenderEvent): Unit = {
val frameState = event.frameState
val elapsed = frameState.get.time - start

// if (elapsed >= duration) {
// ch.wsl.typings.ol.eventsMod.unlistenByKey(listenerKey)
// return
// }

val vectorContext = ch.wsl.typings.ol.renderMod.getVectorContext(event)
val vectorContext2 = ch.wsl.typings.ol.renderMod.getVectorContext(event)
val elapsedRatio = elapsed / period - (elapsed / period).toInt
// radius will be 5 at start and 20 at end.
val radius = ch.wsl.typings.ol.easingMod.easeOut(elapsedRatio) * 15 + 5
val opacity = ch.wsl.typings.ol.easingMod.easeOut(1 - elapsedRatio)

val style = new Style( ch.wsl.typings.ol.styleStyleMod.Options().setImage(
new Circle(styleCircleMod.Options(radius)
.setStroke(new Stroke( ch.wsl.typings.ol.styleStrokeMod.Options()
.setColor(s"rgba(85, 10, 33, $opacity)")
.setWidth(1 + opacity)
))
).asInstanceOf[ch.wsl.typings.ol.imageMod.default]
) )

val styleFIX = new Style( ch.wsl.typings.ol.styleStyleMod.Options().setImage(
new Circle(styleCircleMod.Options(10)
.setStroke(new Stroke( ch.wsl.typings.ol.styleStrokeMod.Options()
.setColor(s"rgba(85,10,33, 1)")
.setWidth(1)
))
.setFill(new styleMod.Fill(styleFillMod.Options().setColor("rgba(85,10,33,0.6)")))
).asInstanceOf[ch.wsl.typings.ol.imageMod.default]
) )

vectorContext.setStyle(style)
vectorContext.drawGeometry(flashGeom)

vectorContext.setStyle(styleFIX)
vectorContext.drawGeometry(flashGeom2)


// tell OpenLayers to continue postrender animation
map.render()
}

listenerKey = layer.onInternal("postrender", (event) => animate(event.asInstanceOf[RenderEvent])).asInstanceOf[ch.wsl.typings.ol.eventsMod.EventsKey]
map.render()

}


implicit class EnanchedMap(map: mod.Map) {

Expand Down
30 changes: 30 additions & 0 deletions client/src/main/scala/ch/wsl/box/client/services/Messages.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ch.wsl.box.client.services

import ch.wsl.box.client.viewmodel.Row
import ch.wsl.box.model.shared.JSONID
import io.circe.Json
import io.udash.Registration
import io.udash.properties.single.Property

sealed trait Message

trait Messages {
def pub(m:Message):Unit
def sub(action:Message => Any):Registration
}

object Messages {
case object Empty extends Message
case class RowHover(row:Row) extends Message
case class RowOut(row:Row) extends Message
}


class MessagesPropertyImpl extends Messages {

val prop:Property[Message] = Property(Messages.Empty)

override def pub(m: Message): Unit = prop.set(m)

override def sub(action: Message => Any): Registration = prop.listen(action)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ trait ServiceModule {
val style = bind[BoxStyleFactory]
val layout = bind[MainLayout]
val preferences = bind[Preferences]
val messages = bind[Messages]
}
5 changes: 5 additions & 0 deletions client/src/main/scala/ch/wsl/box/client/styles/BoxStyle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trait BoxStyle {
val inputInvalid: StyleA
val spaceBetween: StyleA
val topTableContainer: StyleA
val topBarContainer: StyleA
val flexContainer: StyleA
val sidebarRightContent: StyleA
val sidebar: StyleA
Expand Down Expand Up @@ -152,7 +153,11 @@ trait BoxStyle {
val showHide:StyleA
val error:StyleA
val iconBig:StyleA
val filterDynBar:StyleA
val filterBlock:StyleA
val filterBlockTitle:StyleA
val tableTitle:StyleA
val tableMainActions:StyleA


def render[Out](implicit r: Renderer[Out], env: Env):Out
Expand Down
26 changes: 23 additions & 3 deletions client/src/main/scala/ch/wsl/box/client/styles/GlobalStyles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,14 @@ class GlobalStyles(settings:Settings,conf:StyleConf) extends StyleSheet.Inline()
),
justifyContent.spaceBetween,
alignItems.center,
alignContent.center
alignContent.center,
boxShadow := "0px 2px 6px #999",
zIndex(5),
position.relative
)

override val topBarContainer = style()

override val flexContainer = style(
display.flex,
flexDirection.row,
Expand Down Expand Up @@ -844,7 +849,7 @@ class GlobalStyles(settings:Settings,conf:StyleConf) extends StyleSheet.Inline()
height :=! "calc(100vh - 53px)",
overflow.auto,
),
overflow.hidden,
overflow.auto,
width(100.%%)
)

Expand Down Expand Up @@ -1751,6 +1756,11 @@ class GlobalStyles(settings:Settings,conf:StyleConf) extends StyleSheet.Inline()
)
)

override val filterDynBar =style(
display.flex,
alignItems.center
)

val filterBlock = style(
display.flex,
alignItems.center,
Expand All @@ -1773,7 +1783,17 @@ class GlobalStyles(settings:Settings,conf:StyleConf) extends StyleSheet.Inline()

)

//
override val filterBlockTitle = style(
fontWeight.bold,
marginLeft(15 px)
)


override val tableTitle = style()
override val tableMainActions = style(
noMobile
)
//
// val mapPopup = style(
// border.solid,
// borderColor(conf.colors.main),
Expand Down
29 changes: 27 additions & 2 deletions client/src/main/scala/ch/wsl/box/client/styles/Icons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ object Icons {
|""".stripMargin)

//http://simpleicon.com/wp-content/uploads/target1.svg
val target:Icon = raw(
def target(w:Int = 16,h:Int = 16):Icon = raw(
s"""
|<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1em" height="1em" viewBox="0 0 512 512">
|<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="$w" height="$h" viewBox="0 0 512 512">
| <path d="M384.645 256c0 70.942-57.702 128.655-128.655 128.655-70.942 0-128.655-57.712-128.655-128.655 0-70.912 57.723-128.635 128.655-128.635 70.963 0 128.655 57.713 128.655 128.635zM255.99 98.969c-86.558 0-157.020 70.42-157.020 157.031s70.462 157.041 157.020 157.041c86.579 0 157.061-70.441 157.061-157.041 0-86.61-70.482-157.030-157.061-157.030z" fill="currentColor" />
| <path d="M270.192 216.75v-206.428h-28.395v206.418c4.485-1.607 9.196-2.631 14.203-2.631s9.707 1.024 14.192 2.642z" fill="currentColor" />
| <path d="M241.787 295.26v206.418h28.395v-206.418c-4.485 1.608-9.195 2.642-14.203 2.642s-9.708-1.034-14.192-2.642z" fill="currentColor" />
Expand Down Expand Up @@ -409,4 +409,29 @@ object Icons {
|</svg>
|""".stripMargin)

//https://icons.getbootstrap.com/icons/zoom-in/
val zoom:Icon = raw(
s"""
|<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-zoom-in" viewBox="0 0 16 16">
| <path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0"/>
| <path d="M10.344 11.742q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1 6.5 6.5 0 0 1-1.398 1.4z"/>
| <path fill-rule="evenodd" d="M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5"/>
|</svg>
|""".stripMargin
)

//https://www.svgrepo.com/svg/451040/layer-zoom-to
def layerZoom(w:Int = 16,h:Int = 16):Icon = raw(
s"""
|<svg width="$w" height="$h" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M9.277 20.442a7.294 7.294 0 0 0 1.304.744 21.448 21.448 0 0 1-5.157.614A13.093 13.093 0 0 1 0 20.783L3.05 3.078a15.028 15.028 0 0 0 4.52.722c3.849 0 3.893-1.6 7.74-1.6a12.674 12.674 0 0 1 4.52.878l2.642 15.678-1.113-1.114c-.031-.031-.07-.052-.102-.081L18.94 3.815a11.86 11.86 0 0 0-3.63-.615 7.791 7.791 0 0 0-3.49.725 9.805 9.805 0 0 1-4.25.875 16.193 16.193 0 0 1-3.723-.457L1.124 20.15a13.726 13.726 0 0 0 4.3.65 19.768 19.768 0 0 0 3.853-.358zm13.519 1.467a.68.68 0 0 1 0 .962l-.934.932a.666.666 0 0 1-.943 0l-2.855-2.855a.668.668 0 0 1 0-.943l.129-.13-1.32-1.318a5.362 5.362 0 1 1 .69-.69l1.32 1.319.124-.124a.668.668 0 0 1 .943 0zm-4.994-7.41a4.3 4.3 0 1 0-4.3 4.3 4.304 4.304 0 0 0 4.3-4.3zm4.06 7.89l-2.383-2.385-.473.473 2.385 2.383zM14 12h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|""".stripMargin
)

//https://www.svgrepo.com/svg/450856/extent-filter
def extentFilter(w:Int = 16,h:Int = 16):Icon = raw(
s"""
|<svg width="$w" height="$h" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 16h1v6h-6v-1h5zM3 3h5V2H2v6h1zm13 0h5v5h1V2h-6zm-2 6v2l-4 4-1 8H6l-1-8-4-4V9zm-5.133 6H6.133l.75 7h1.234zm2.719-3H3.414l2 2h4.172zM13 10H2v.586l.414.414h10.172l.414-.414z"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|""".stripMargin
)

}
Loading
Loading