Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev branch #66

Merged
merged 15 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed calculation of location for path and polygons .
  • Loading branch information
ISeleznev-HORIS authored and IKupriyanov-HORIS committed Dec 18, 2019
commit f1e711f7d4fe26143fa4df51fd12d4aa85b5df2f
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fun limitLon(lon: Double) = max(
MIN_LONGITUDE, min(lon,
MAX_LONGITUDE
))

fun limitLat(lat: Double) = max(
MIN_LATITUDE, min(lat,
MAX_LATITUDE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ object GeoUtils {

return GeoRectangle(
left,
limitLat(rect.top), right,
limitLat(rect.top),
right,
limitLat(rect.bottom)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

package jetbrains.livemap.entities.geocoding

import jetbrains.datalore.base.spatial.GeoUtils.convertToGeoRectangle
import jetbrains.datalore.base.typedGeometry.Rect
import jetbrains.datalore.base.spatial.GeoRectangle
import jetbrains.datalore.base.spatial.limitLat
import jetbrains.datalore.base.typedGeometry.*
import jetbrains.livemap.LiveMapContext
import jetbrains.livemap.LiveMapSystem
import jetbrains.livemap.core.ecs.EcsComponentManager
import jetbrains.livemap.entities.placement.WorldDimensionComponent
import jetbrains.livemap.entities.placement.WorldOriginComponent
import jetbrains.livemap.projections.Coordinates.ZERO_LONLAT_POINT
import jetbrains.livemap.projections.Coordinates.ZERO_WORLD_POINT

class LocationCalculateSystem(
componentManager: EcsComponentManager
Expand All @@ -29,12 +30,19 @@ class LocationCalculateSystem(
.forEach { entity ->
entity.remove<NeedCalculateLocationComponent>()

Rect(
context.mapProjection.invert(entity.get<WorldOriginComponent>().origin),
entity.tryGet<WorldDimensionComponent>()?.dimension?.run(context.mapProjection::invert) ?: ZERO_LONLAT_POINT
)
.run(::convertToGeoRectangle)
.run(myLocation::add)
val origin = entity.get<WorldOriginComponent>().origin
val dimension = entity.tryGet<WorldDimensionComponent>()?.dimension ?: ZERO_WORLD_POINT

val bottomLeft = context.mapProjection.invert(origin)
val topRight = context.mapProjection.invert(origin + dimension)

GeoRectangle(
bottomLeft.x,
limitLat(topRight.y),
topRight.x,
limitLat(bottomLeft.y)

).run(myLocation::add)
}
}

Expand Down