Skip to content

Commit

Permalink
Use new map markers and more work on Journeys
Browse files Browse the repository at this point in the history
  • Loading branch information
webprofusion-chrisc committed May 31, 2016
1 parent 2a08a65 commit c17169a
Show file tree
Hide file tree
Showing 44 changed files with 397 additions and 119 deletions.
10 changes: 8 additions & 2 deletions App/Ionic2/ocm-app/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {APIClient} from './core/ocm/services/APIClient';
import {AppManager} from './core/ocm/services/AppManager'
import {POIManager} from './core/ocm/services/POIManager'
import {SubmissionQueue} from './core/ocm/services/SubmissionQueue'
import {JourneyManager} from './core/ocm/services/JourneyManager';
import {ReferenceDataManager} from './core/ocm/services/ReferenceDataManager';
import {Base} from './core/ocm/Base';
import {TabsPage} from './pages/tabs/tabs';

Expand All @@ -22,14 +24,18 @@ enableProdMode();
template: '<ion-nav [root]="rootPage"></ion-nav>',
providers: [
AppManager,
POIManager,
Events,
provide(TranslateLoader, {
useFactory: (http: Http) => new TranslateStaticLoader(http, 'lang', '.json'),
deps: [Http]
}),
TranslateService,

APIClient, SubmissionQueue],
APIClient,
SubmissionQueue,
JourneyManager,
ReferenceDataManager
],
config: {
mode: "ios"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,18 @@ this.map.setDebuggable(true);
var shadow = null;
var markerImg = null;

iconURL = "images/icons/map/set4_level" + poiLevel;
iconURL = "images/icons/map/level" + poiLevel;

if (poi.UsageType != null && poi.UsageType.Title.indexOf("Private") > -1) {
iconURL += "_private";
} else if (poi.StatusType != null && poi.StatusType.IsOperational != true) {
iconURL += "_nonoperational";
} else {
iconURL += "_operational";
}

iconURL += ".png";
iconURL += "_icon.png";


var markerTooltip = "OCM-" + poi.ID + ": " + poi.AddressInfo.Title + ":";
if (poi.UsageType != null) markerTooltip += " " + poi.UsageType.Title;
Expand Down
24 changes: 15 additions & 9 deletions App/Ionic2/ocm-app/app/core/ocm/mapping/providers/GoogleMapsWeb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export class GoogleMapsWeb extends Base implements IMapProvider {
google.maps.event.addListener(this.map, 'zoom_changed', function () {
mapProviderContext.events.publish('ocm:mapping:zoom');
});
google.maps.event.addListener(this.map, 'idle', function () {

google.maps.event.addListener(this.map, 'idle', function () {
mapProviderContext.events.publish('ocm:mapping:ready');
});

Expand Down Expand Up @@ -169,12 +169,18 @@ export class GoogleMapsWeb extends Base implements IMapProvider {
var shadow = null;
var markerImg = null;

iconURL = "images/icons/map/set4_level" + poiLevel;
iconURL = "images/icons/map/level" + poiLevel;

if (poi.UsageType != null && poi.UsageType.Title.indexOf("Private") > -1) {
iconURL += "_private";
} else if (poi.StatusType != null && poi.StatusType.IsOperational != true) {
iconURL += "_nonoperational";
} else {
iconURL += "_operational";
}

iconURL += ".png";
iconURL += "_icon.png";


markerImg = new google.maps.MarkerImage(
iconURL,
Expand Down Expand Up @@ -265,11 +271,11 @@ export class GoogleMapsWeb extends Base implements IMapProvider {
//wrap getCenter in an observable
let obs = Observable.create(observer => {
var pos = this.map.getCenter();
if (pos != null) {
observer.next(new GeoPosition(pos.lat(), pos.lng()));
observer.complete();
}
if (pos != null) {
observer.next(new GeoPosition(pos.lat(), pos.lng()));
observer.complete();
}

});

return obs;
Expand Down
29 changes: 17 additions & 12 deletions App/Ionic2/ocm-app/app/core/ocm/mapping/providers/LeafletMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class LeafletMap extends Base implements IMapProvider {
/** Clear current markers */
clearMarkers() {
if (this.markerList != null) {
this.log("Clearing all markers ["+this.markerList.size()+"]");
this.log("Clearing all markers [" + this.markerList.size() + "]");
for (var i = 0; i < this.markerList.size(); i++) {
if (this.markerList[i]) {
this.markerList[i].setMap(null);
Expand Down Expand Up @@ -126,13 +126,7 @@ export class LeafletMap extends Base implements IMapProvider {
if (poiList != null) {
//render poi markers

var defaultMarkerIcon = L.icon({
iconUrl: 'images/icons/map/set4_level0.png',

iconSize: [34, 50], // size of the icon
iconAnchor: [15, 45] // point of the icon which will correspond to marker's location
// popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
});

var poiCount = poiList.length;
for (var i = 0; i < poiList.length; i++) {
Expand Down Expand Up @@ -160,13 +154,24 @@ export class LeafletMap extends Base implements IMapProvider {
var shadow = null;
var markerImg = null;

iconURL = "images/icons/map/set4_level" + poiLevel;
iconURL = "images/icons/map/level" + poiLevel;
if (poi.UsageType != null && poi.UsageType.Title.indexOf("Private") > -1) {
iconURL += "_private";
} else if (poi.StatusType != null && poi.StatusType.IsOperational != true) {
iconURL += "_nonoperational";
} else {
iconURL += "_operational";
}

iconURL += ".png";
iconURL += "_icon.png";

var defaultMarkerIcon = L.icon({
iconUrl: iconURL,

iconSize: [34, 50], // size of the icon
iconAnchor: [15, 45] // point of the icon which will correspond to marker's location
// popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
});

var markerTooltip = "OCM-" + poi.ID + ": " + poi.AddressInfo.Title + ":";
if (poi.UsageType != null) markerTooltip += " " + poi.UsageType.Title;
Expand Down Expand Up @@ -260,10 +265,10 @@ export class LeafletMap extends Base implements IMapProvider {
}

setMapZoom(zoomLevel: number) {
if (this.mapReady){
this.map.setZoom(zoomLevel);
if (this.mapReady) {
this.map.setZoom(zoomLevel);
}

}

getMapZoom(): Observable<number> {
Expand Down
5 changes: 3 additions & 2 deletions App/Ionic2/ocm-app/app/core/ocm/model/AppModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ export {AsyncResult} from "./AsyncResult";
export {SubmissionQueueItem} from "./SubmissionQueueItem";
export {SubmissionType} from './SubmissionType';
export {UserComment} from './UserComment';
export {Journey,WayPoint} from './Journey';
export {Journey, JourneyStage, WayPoint, BookmarkedPOI} from './Journey';
export {PlaceSearchResult} from './PlaceSearchResult';
export {GeoLatLng, GeoPosition} from './GeoPosition';
export {SearchSettings} from './SearchSettings';
export {CoreReferenceData} from './CoreReferenceData';
export {ConnectionInfo} from './ConnectionInfo';
export {POISearchParams} from './POISearchParams';
export {POISearchParams} from './POISearchParams';
export {SyncItem} from './SyncItem';
66 changes: 54 additions & 12 deletions App/Ionic2/ocm-app/app/core/ocm/model/Journey.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,65 @@
import {GeoLatLng} from './GeoPosition';
import {SyncItem} from './SyncItem';

export class WayPoint{

export interface ISyncItem {
_sync: SyncItem;
}

class JourneyBaseItem implements ISyncItem {
public Title: string;
public Notes: string;
public _sync: SyncItem;

constructor(itemType: string, schemaVersion:number) {
this._sync = new SyncItem(itemType, schemaVersion);
}
}

export class BookmarkedPOI extends JourneyBaseItem implements ISyncItem {
public PoiID: number;
public Type: string;
public Poi: any;

public _sync: SyncItem;
}

export class WayPoint extends JourneyBaseItem {

public Stage: number;
public Position: GeoLatLng;
public PoiIDs:Array<number>;
public PoiList: Array<any>;

public PoiIDs: Array<number>;
public PoiList: Array<BookmarkedPOI>;

public constructor() {
super("waypoint", 1);
}

}

export class Journey{
public ID:string;
public Title:string;
public Notes: string;
export class JourneyStage extends JourneyBaseItem {

public WayPoints: Array<WayPoint>;

public constructor(){
this.ID = ""+Date.now;
this.WayPoints=[];

public constructor() {
super("journey_stage", 1);

this.WayPoints = [];
}
}

export class Journey extends JourneyBaseItem {

public ID: string;

public Stages: Array<JourneyStage>;



public constructor() {
super("journey", 1);
this.ID = "" + Date.now();
this.Stages = [];

}
}
23 changes: 23 additions & 0 deletions App/Ionic2/ocm-app/app/core/ocm/model/SyncItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export class SyncItem {

public itemType: string;
public itemId: string;
public version: number;
public schemaVersion: number;
public syncTimeStamp: string;

public constructor(itemType: string, schemaVersion: number) {
this.itemType = itemType;
this.itemId = SyncItem.getNewItemId();
this.version = 1;
this.schemaVersion = schemaVersion;
this.syncTimeStamp = SyncItem.getNewSyncTimeStamp();

}
public static getNewSyncTimeStamp() {
return Date.now().toString();
}
public static getNewItemId() {
return "_syncitem_" + Date.now().toString();
}
}
17 changes: 7 additions & 10 deletions App/Ionic2/ocm-app/app/core/ocm/services/AppManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ import {JwtHelper} from 'angular2-jwt';
import {UserProfile, SubmissionType, SearchSettings, Journey, WayPoint, GeoLatLng} from '../model/AppModels'
import {SubmissionQueue} from './SubmissionQueue';
import {ReferenceDataManager} from './ReferenceDataManager';
import {POIManager} from './POIManager';
import {JourneyManager} from './JourneyManager';

@Injectable()

export class AppManager extends Base {
jwtHelper = new JwtHelper();
enableSubmissionQueue: boolean;

public referenceDataManager: ReferenceDataManager;
public journeyManager : JourneyManager;
public poiManager: POIManager;
public searchSettings: SearchSettings;
public platformMode: string;
public journeys: Array<Journey>;
Expand All @@ -35,7 +30,7 @@ export class AppManager extends Base {

public isRequestInProgress: boolean = false;

constructor(public http: Http, public events: Events, public api: APIClient, public submissionQueue: SubmissionQueue, private platform: Platform) {
constructor(public http: Http, public events: Events, public api: APIClient, public submissionQueue: SubmissionQueue, private platform: Platform, public referenceDataManager: ReferenceDataManager, public journeyManager: JourneyManager) {
super();
this.api.clientName = "ocm.app.ionic.v6_0_0";
this.isDebugMode = false;
Expand All @@ -48,15 +43,17 @@ export class AppManager extends Base {
this.platformMode = "web";
}

this.referenceDataManager = new ReferenceDataManager(http);
this.journeyManager = new JourneyManager();
this.poiManager = new POIManager(this);
// this.referenceDataManager = new ReferenceDataManager(http);

// this.poiManager = new POIManager(this);

this.searchSettings = new SearchSettings();

this.loadSearchSettings();

this.journeyManager.setupTestJourneys();

//this.journeyManager.setupTestJourneys();
this.journeyManager.loadJourneys();
}

/**
Expand Down
Loading

0 comments on commit c17169a

Please sign in to comment.