Skip to content

Commit

Permalink
Merge Openlayers branch to master (#877)
Browse files Browse the repository at this point in the history
* Support map rotation #669 - initial commit. a complete rewrite of the site to use openlayer, still not complete. Resolves #402 - Support global undo instead of undo per route.

* Support map rotation #669 - lint fixes, added north icon.

* Support map rotation #669 - Fix compilation due to unused events.

* Support map rotation #669 - Remove events and some leaflet usages.

* Support map rotation #669 - Fix compilation, removed more $events.

* Support map rotation #669 - Fix compilation

* Support map rotation #669 - Fix compilation due to unneeded classes.

* Support map rotation #669 - remove some unused code.

* Support map rotation #669 - Added clustering and route recording, fixed tranlation typos, added missing translations, fixed other small stuff to make things work.

* Support map rotation #669 - added make all route points editable.

* Replaced wrench with 3 vertical dots. #669

* Support various clear route options #669

* Resolves #787 - Allow opening of a specific POI in a group.
Related to #669.

* Support map rotation #669 - Added mapserver support using xyz tiles.

* Support map rotation #669 - Added snapping back. removed unused code.

* Support map rotation #669 - bring back tests.

* Support map rotation #669 - small correction related to cordova.

* Support map rotation #669 - remove leaflet, fixed delete route, updated file saver.

* Support map rotation #669 - Fix lint.

* Support map rotation #669 - Fix tests.

* Support map rotation #669 - Split android and web builds

* Support map rotation #669 - Split build, fix yml.

* Support map rotation #669 - Fix compilation after lint required fixes  :-/

* Support map rotation #669 - Throw if angular build fails.

* Support map rotation #669 - Fix android build due to split

* Support map rotation #669 - Updated version to 8.0

* Support map rotation #669 - Added GPS location interaction.

* Support map rotation #669 - Moved most of the popups to be overlays.

* Support map rotation #669 - Fix production compilation

* #669 - Moved pure map components to a folder.

* #669 - fix compilation.

* Fixed issue with version in GPX and improve description of uploaded OSM trace.

* Support map rotation #669 - Added traces layer and ability to manipulate.

* Fixes #856 - Fix failing android builds

* Support map rotation #669 - Fix tests, fix issue with animation override when following GPS location.

* Support map rotation #669 - facilitate drag and drop of a file.

* Support map rotation #669 - Fix fit to bounds. Fix legend. Fix move to search results.

* Support map rotation #669 - add zoom animation for zoom-in/out

* Support map rotation #669 - remove unwanted OSM layer.

* Support map rotation #669 - Moved layers and user to state management.

* Support map rotation #669 - Make advance route actions under a ... button

* Support map rotation #669 - Fix lint

* Support map rotation #669 - Fix production build, remove opacity from base layer, changed opacity slider to be green.

* Support map rotation #669 - reverse route in route properties, fixed some mouse events, fixed visibilty of route.

* Support map rotation #669 - Fix toggle category layer causes collapse.

* Support map rotation #669 - Fix incorrect color and weight.

* Support map rotation #669 - Fix production compilation due to missing method.

* Error adding routes to OSM #848 - Might be related, but might be a different issue.

* Support map rotation #669 - add route direction

* Support map rotation #669 - show direction only in readonly mode, show route points only in route editing mode. emit null when dragging interaction to hide hover marker.

* Support map rotation #669 - Fix opening a file that has only markers.

* Support map rotation #669, Support offline tiles #783 - Added PouchDB, update technology stack

* #669 - Update reducer action decorator to hold all the relevant classes.

* Support map rotation #669 - Show searchresult marker, fix production build

* Support map rotation #669 - Fix lint, move search results to poi service.

* Support map rotation #669 - Improve search results icon and some errors.

* Support map rotation #669 - improve private POI UX. added icons to private POI back.

* Support map rotation #669 - support database writing in another thread.

* Support map rotation #669 - make sure font loads before anything else to prevent missing icons on the map.

* Avoid using environment but use running context instead.

* Support map rotation #669 - Fix issue with a segment with a single point.

* Support map rotation #669 - add tooltip to north-up

* Support map rotation #669 - do not store and read state when runnning inside iFrame.

* Support map rotation #669 - Add extra data indicator.

* Resolves  #861 - Update to angular 7

* Support map rotation #669 - Add coordinates and height to private POI dialog. remove comments, added some TODOs.

* Update to angular 7 #861 - Update typescript to 3.1.6, remove unused import.

* Update to angular 7 #861 - remove css files to reduce build time? change appveyor worker cloud

* Support map rotation #669 - Small fix to route editing.

* Update to angular 7 #861 - downgrade to 7.0.4 to check if this solves build issues.

* Another attempt to fix appveyor run...

* Support map rotation #669 - Make recording work.

* Support map rotation #669 - fixed issue with undo.
Update to angular 7 #861 - reduce angular-cli back to 6.1.6 to prevent out of memory.

* Update to angular 7 #861 - Increase memory limit to all commands.

* Update to angular 7 #861 - Update typescript for cli.

* Update to angular 7 #861 - Fix lint.

* Fixes #866 - Geo-tagged images won't open (beta)

* Moved to ngx-openlayers next version. #669
  • Loading branch information
HarelM authored Dec 5, 2018
1 parent 9514e2c commit 8b6df7f
Show file tree
Hide file tree
Showing 247 changed files with 22,656 additions and 16,331 deletions.
52 changes: 35 additions & 17 deletions IsraelHiking.API/Services/Osm/OsmLineAdderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task Add(LineString line, Dictionary<string, string> tags, TokenAnd
var createdElements = new List<OsmGeo>();
var modifiedElement = new List<OsmGeo>();
int generatedId = -1;
var nodeIds = new List<string>();
var newWayNodeIds = new List<string>();
var highways = await GetHighwaysInArea(line);
var itmHighways = highways.Select(ToItmLineString).ToList();
var waysToUpdateIds = new List<long?>();
Expand All @@ -67,41 +67,48 @@ public async Task Add(LineString line, Dictionary<string, string> tags, TokenAnd
if (coordinateIndex > 0)
{
var previousCoordinate = line.Coordinates[coordinateIndex - 1];
AddIntersectingNodes(previousCoordinate, coordinate, nodeIds, itmHighways, highways);
AddIntersectingNodes(previousCoordinate, coordinate, newWayNodeIds, itmHighways, highways);
}
var closetHighway = GetClosetHighway(coordinate, itmHighways, highways);
if (closetHighway == null)
{
// no close highways, adding a new node
var node = new Node {Id = generatedId--, Latitude = coordinate.Y, Longitude = coordinate.X};
createdElements.Add(node);
nodeIds.Add(node.Id.ToString());
newWayNodeIds.Add(node.Id.ToString());
continue;
}
var itmPoint = GetItmCoordinate(coordinate);
var closestItmHighway = itmHighways.First(hw => hw.GetOsmId() == closetHighway.GetOsmId());
var closestItmPointInWay = closestItmHighway.Coordinates.OrderBy(c => c.Distance(itmPoint.Coordinate)).First();
var indexOnWay = closestItmHighway.Coordinates.ToList().IndexOf(closestItmPointInWay);
var closestNodeId = ((List<object>)closetHighway.Attributes[FeatureAttributes.OSM_NODES])[indexOnWay].ToString();
if (!CanAddNewNode(nodeIds, closestNodeId))
if (!CanAddNewNode(newWayNodeIds, closestNodeId))
{
continue;
}
if (closestItmPointInWay.Distance(itmPoint.Coordinate) <= _options.MaxDistanceToExisitngLineForMerge)
{
// close hihgway, adding the node id from that highway
nodeIds.Add(closestNodeId);
// close highway, adding the node id from that highway
newWayNodeIds.Add(closestNodeId);
continue;
}
// need to add a new node to existing highway
var newNode = new Node {Id = generatedId--, Latitude = coordinate.Y, Longitude = coordinate.X};
createdElements.Add(newNode);
nodeIds.Add(newNode.Id.ToString());
var simpleWay = await AddNewNodeToExistingWay(newNode.Id.ToString(), closestItmHighway, indexOnWay, itmPoint);
newWayNodeIds.Add(newNode.Id.ToString());
var indexToInsert = GetIndexToInsert(indexOnWay, closestItmHighway, itmPoint);
if (modifiedElement.FirstOrDefault(w => w.Id.ToString() == closestItmHighway.GetOsmId()) is Way modifiedWay &&
modifiedWay.Nodes[indexToInsert] < 0)
{
// a new node was added to this highway - no reason to add a new one to the same location
continue;
}
var simpleWay = await AddNewNodeToExistingWay(newNode.Id.ToString(), closestItmHighway.GetOsmId(), indexToInsert);
modifiedElement.Add(simpleWay);
waysToUpdateIds.Add(simpleWay.Id);
}
var newWay = CreateWay(nodeIds, tags, generatedId--);
var newWay = CreateWay(newWayNodeIds, tags, generatedId--);
createdElements.Add(newWay);
waysToUpdateIds.Add(newWay.Id);

Expand All @@ -128,10 +135,17 @@ public async Task Add(LineString line, Dictionary<string, string> tags, TokenAnd
}
}

/// <summary>
/// This method checks if a new node should and can be added
/// </summary>
/// <param name="nodeIds"></param>
/// <param name="newNodeId"></param>
/// <returns></returns>
private static bool CanAddNewNode(List<string> nodeIds, string newNodeId)
{
if (nodeIds.Any() && nodeIds.Last() == newNodeId)
{
// last node that was added had the same Id
return false;
}
if (nodeIds.Contains(newNodeId) && nodeIds.IndexOf(newNodeId) == nodeIds.Count - 2)
Expand Down Expand Up @@ -168,24 +182,28 @@ private void AddIntersectingNodes(Coordinate previousCoordinate, Coordinate coor
}
}

private async Task<Way> AddNewNodeToExistingWay(string nodeId, LineString closestItmHighway, int indexOnWay, Point itmPoint)
private async Task<Way> AddNewNodeToExistingWay(string nodeId, string wayId, int indexToInsert)
{
var simpleWay = await _osmGateway.GetWay(wayId);
var updatedList = simpleWay.Nodes.ToList();
updatedList.Insert(indexToInsert, long.Parse(nodeId));
simpleWay.Nodes = updatedList.ToArray();
return simpleWay;
}

private int GetIndexToInsert(int indexOnWay, LineString closestItmHighway, Point itmPoint)
{
var indexToInsert = indexOnWay;
if (indexOnWay != closestItmHighway.Coordinates.Length - 1)
{
// HM TODO: fix this using projection
var postItmLine = new LineString(new [] { closestItmHighway.Coordinates[indexOnWay], closestItmHighway.Coordinates[indexOnWay + 1] });
var postItmLine = new LineString(new[] { closestItmHighway.Coordinates[indexOnWay], closestItmHighway.Coordinates[indexOnWay + 1] });
if (postItmLine.Distance(itmPoint) <= _options.MaxDistanceToExisitngLineForMerge)
{
indexToInsert = indexOnWay + 1;
}
}

var simpleWay = await _osmGateway.GetWay(closestItmHighway.GetOsmId());
var updatedList = simpleWay.Nodes.ToList();
updatedList.Insert(indexToInsert, long.Parse(nodeId));
simpleWay.Nodes = updatedList.ToArray();
return simpleWay;
return indexToInsert;
}

private async Task<List<Feature>> GetHighwaysInArea(LineString line)
Expand Down
2 changes: 1 addition & 1 deletion IsraelHiking.DataAccess/OpenStreetMap/OsmGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public async Task CreateTrace(string fileName, MemoryStream fileStream)
UpdateHeaders(client, _createTraceAddress, "POST");
var parameters = new Dictionary<string, string>
{
{ "description", fileName },
{ "description", Path.GetFileNameWithoutExtension(fileName) },
{ "visibility", "public" },
{ "tags", "" },
};
Expand Down
16 changes: 0 additions & 16 deletions IsraelHiking.Web/IsraelHiking.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,4 @@
<ProjectReference Include="..\IsraelHiking.DataAccessInterfaces\IsraelHiking.DataAccessInterfaces.csproj" />
<ProjectReference Include="..\IsraelHiking.DataAccess\IsraelHiking.DataAccess.csproj" />
</ItemGroup>
<Target Name="NodeInitialize">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />

<Message Importance="high" Text="Installing all npm packages" />
<Exec Command="npm install --loglevel=error" />
</Target>

<Target Name="ReleaseRunNgBuild" BeforeTargets="Build" DependsOnTargets="NodeInitialize" Condition=" '$(Configuration)' == 'Release' and '$(DeployOnBuild)' != 'true'">
<Message Importance="high" Text="Starting Ng Build for production" />
<Exec Command="npm run-script build -- --prod --no-progress" />
<Message Importance="high" Text="Ng Build for production ended" />
</Target>
</Project>
3 changes: 0 additions & 3 deletions IsraelHiking.Web/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
"scripts": [
"sources/google-analytics.js"
],
"styles": [
"sources/common.scss"
],
"assets": [
"sources/content",
"sources/translations",
Expand Down
8 changes: 5 additions & 3 deletions IsraelHiking.Web/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="il.org.osm.israelhiking" version="7.2.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="il.org.osm.israelhiking" version="8.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Israel Hiking Map</name>
<description>An application for outdoor navigation.</description>
<author email="IsraelHikingMap@gmail.com" href="http://israelhiking.osm.org.il">Israel Hiking Map</author>
Expand Down Expand Up @@ -36,7 +36,7 @@
<icon height="180" src="www/content/favicons/apple-touch-icon-180x180.png" width="180" />
</platform>
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^3.0.0-alpha.40">
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^3.0.0-alpha.47">
<variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11+" />
<variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="26+" />
<variable name="ALWAYS_USAGE_DESCRIPTION" value="App requires background tracking enabled" />
Expand All @@ -54,6 +54,8 @@
</universal-links>
<plugin name="cordova-plugin-deeplinks" spec="^1.1.0" />
<plugin name="cordova-plugin-insomnia" spec="^4.3.0" />
<plugin name="cordova-android-play-services-gradle-release" spec="^1.4.4">
<variable name="PLAY_SERVICES_VERSION" value="11.6.2" />
</plugin>
<engine name="android" spec="^7.0.0" />
<engine name="browser" spec="^5.0.4" />
</widget>
Loading

0 comments on commit 8b6df7f

Please sign in to comment.