65 lines
63 KiB
JavaScript
65 lines
63 KiB
JavaScript
|
/*
|
||
|
* Edited by: Nermin Jukan, 63150367
|
||
|
* Date: 16. 05. 2018
|
||
|
* Modifications: Added a new GeoLayer for "cisko_2" on lines 29, 32.
|
||
|
*
|
||
|
* */
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
angular
|
||
|
.module('sloDialectsApp')
|
||
|
.factory('geojsonService', ['$http', function($http) {
|
||
|
|
||
|
return {
|
||
|
getAll: getAll,
|
||
|
getAllSorted: getAllSorted,
|
||
|
getDialectGroups: getDialectGroups
|
||
|
}
|
||
|
|
||
|
function getAll(){
|
||
|
return $http.get('resources/geojson/sloDialectsGeojsonRemastered.json', {cache: true}).then(function(data) {
|
||
|
return data;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function getAllSorted(){
|
||
|
return $http.get('resources/geojson/sloDialectsGeojsonRemastered.json', {cache: true}).then(function(response) {
|
||
|
var kocevje_bg = {"type":"Feature","properties":{"id":"mesani_kocevski_govori_narecje","stroke":"#aeaeae"},"geometry":{"type":"Polygon","coordinates":[[[14.954583894977496,45.51580673022253],[14.952514749054904,45.51695136528512],[14.950995220018001,45.517894005924894],[14.949281708550854,45.51921819158553],[14.947277223438343,45.52034038282336],[14.9458870160216,45.521170804339356],[14.94385020050405,45.52253987764951],[14.94258931470747,45.523549849763555],[14.940778812025203,45.524312939805284],[14.939129961368137,45.525412687218356],[14.937222467470747,45.526489990806674],[14.935153321548155,45.527320412322666],[14.934086418181817,45.528150833838666],[14.933181166840683,45.52873437328233],[14.931467655373536,45.52904858682893],[14.929948071084477,45.529093529272934],[14.929948126336633,45.52909347447844],[14.928460998743258,45.52884654309107],[14.92846092770477,45.52884659240612],[14.927490928728737,45.528465036426354],[14.927491015553555,45.528465047385254],[14.926941367095205,45.52808352976164],[14.926941398667866,45.528083502364396],[14.926133106969193,45.52783668056601],[14.926133138541854,45.52783662029207],[14.925486459402556,45.52776928333835],[14.925486530441043,45.5277692888178],[14.92380541252426,45.52767955735437],[14.923805349378938,45.52767951351878],[14.923223488913026,45.52763462586926],[14.923223402088208,45.52763462586926],[14.922350504831611,45.527589694384154],[14.922350481152115,45.527589738219746],[14.920766346557286,45.527163256234324],[14.92076629130513,45.52716330554937],[14.920216674419441,45.526736872879],[14.919667057533754,45.526355327858134],[14.919311423078307,45.52597378283727],[14.919408414293429,45.52435782745479],[14.919343753483348,45.523078529443666],[14.919085110243024,45.52229299557719],[14.918470832547253,45.521529905535466],[14.917436259585958,45.52083414696801],[14.915916730549053,45.5201159445758],[14.915270122448245,45.520003725452014],[14.914752835967596,45.519869062503474],[14.91436487110711,45.519667068080665],[14.912198733969396,45.51930796688456],[14.909773953591358,45.51924063541029],[14.90796343512276,45.51937531479718],[14.90796345090909,45.51937529835883],[14.90621766428906,45.51950997226627],[14.906217609036903,45.51950996130737],[14.90450405810393,45.51982421868956],[14.904504097569756,45.51982417485396],[14.902564312733151,45.519869013188426],[14.902564273267327,45.519869062503474],[14.90030114491449,45.51982421868956],[14.90030114491449,45.51982417485396],[14.898490642232224,45.51982417485396],[14.896292174689469,45.51982417485396],[14.89503128889289,45.52002616927677],[14.893382438235824,45.5199588378025],[14.890925248521091,45.52000367065752],[14.890925327452745,45.520003725452014],[14.889308728269066,45.519801752947004],[14.88930880720072,45.519801731029204],[14.887724569994742,45.51955490375138],[14.887724617353735,45.51955484895688],[14.886205135675823,45.51930791756951],[14.886205088316832,45.51930796688456],[14.884523891468394,45.51948750652372],[14.884523907254724,45.51948751748261],[14.882972095171771,45.51935284905462],[14.882972047812782,45.51935285453407],[14.88145246352372,45.51921819158553],[14.881452518775877,45.51921819158553],[14.879900667227098,45.51894887664735],[14.879900659333932,45.51894886568845],[14.87870445802693,45.51921819158553],[14.878704434347435,45.51921819158553],[14.877184826378878,45.51946504078116],[14.87718490531053,45.519465073657855],[14.875180357052697,45.519263123070644],[14.875180420198019,45.519263079235046],[14.872885024585464,45.51933038331207],[14.872884961440143,45.519330410709316],[14.870072295133273,45.51946504078116],[14.87007221620162,45.519465073657855],[14.86855266348522,45.51991394467354],[14.868552687164716,45.51991395015299],[14.866612862862285,45.51991395015299],[14.864123413781002,45.519801752947004],[14.864123421674167,45.519801731029204],[14.862377642947301,45.51993641041609],[14.86237757980198,45.519936393977744],[14.860437700247392,45.519801752947004],[14.86043775549955,45.519801731029204],[14.858950627906173,45.519532438008824],[14.858950556867686,45.519532405132125],[14.8574957202135
|
||
|
var cisko_2 =
|
||
|
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[14.207654547326733,45.48965967438108],[14.207816199351935,45.48952501143254],[14.209820684464447,45.48844770784422],[14.209465073688497,45.48795396013793],[14.209465050009001,45.48795394369958],[14.209174111882879,45.48746012476044],[14.209174076363636,45.48746017955494],[14.20881842612186,45.486899029141526],[14.20881844190819,45.48689908393602],[14.208430477047704,45.48633793352261],[14.208430477047704,45.4863379883171],[14.207977804018146,45.48577683790369],[14.207977851377137,45.48577689269819],[14.207234267847536,45.4849464273466],[14.207234252061205,45.4849464711822],[14.206749331504842,45.48386916759388],[14.206749295985599,45.48386916759388],[14.2065876202809,45.48337546920263],[14.206587643960395,45.48337540344923],[14.206490633012361,45.482387935433884],[14.206490652745273,45.482387875159944],[14.20681395679568,45.48202875752549],[14.20681395679568,45.48202877396383],[14.207880816749606,45.48144519616402],[14.207880860162016,45.481445234520166],[14.208268864488328,45.481086155241854],[14.208268825022502,45.481086133324055],[14.209400349733093,45.48043519665272],[14.209400389198919,45.48043526240612],[14.20813950340234,45.479784391488174],[14.206329020452985,45.47915601918948],[14.206329000720071,45.47915596439499],[14.206652344236304,45.47839286887382],[14.206652304770477,45.47839287435327],[14.20684631877338,45.47729314337854],[14.206846287200719,45.47729312694019],[14.20684631877338,45.475834239974866],[14.206846287200719,45.475834278331014],[14.20684631877338,45.47457739126795],[14.206846287200719,45.47457742414464],[14.207395880406912,45.47251259774649],[14.207395904086408,45.47251259226704],[14.207557591630854,45.47047026996758],[14.207557556111611,45.47047020421418],[14.2065876202809,45.470088626316624],[14.206587643960395,45.47008865919332],[14.203160621026102,45.47089663688456],[14.201996726444644,45.47123329425591],[14.200121562952296,45.47174950222531],[14.19795542581458,45.47224326636996],[14.196274244752475,45.472894137287895],[14.194819376525652,45.473500120556324],[14.192265274527452,45.47383677792767],[14.191133710351036,45.47457742414464],[14.1889998720457,45.47531807584106],[14.188999903618361,45.47531807036161],[14.186639815623066,45.47518341837197],[14.186639784050405,45.47518340741307],[14.184926272583258,45.47655248072323],[14.182857126660666,45.477607340486784],[14.180593998307831,45.47828065522948],[14.178233878739874,45.47888663849791],[14.175776748223882,45.479515060111645],[14.175776767956796,45.479515065591094],[14.172578930969951,45.47984451200703],[14.172511444406696,45.47985177227749],[14.172511397047705,45.479851722962444],[14.169375391171185,45.47996396400403],[14.169375347758775,45.47996394208623],[14.167047598061686,45.480053689988004],[14.16704755859586,45.48005371738525],[14.165495703100497,45.48009862147312],[14.165495699153915,45.48009860503477],[14.163749833602232,45.48016588171454],[14.163749857281728,45.48016593650904],[14.161551389738973,45.4803679364113],[14.161551389738973,45.48036793093185],[14.159805520240708,45.480547525365495],[14.159805547866785,45.480547481529904],[14.158092012720143,45.48079437456112],[14.158092036399639,45.48079436360222],[14.155182295999412,45.481355470180034],[14.155182299945995,45.481355459221135],[14.153339466858686,45.481422790695405],[14.151852268226822,45.48092902655076],[14.150332739189919,45.48030059945758],[14.149298166228622,45.47962728471488],[14.1478432980018,45.47866220025035],[14.146129786534653,45.47751756518776],[14.145030552763275,45.47664225602225],[14.144707248712871,45.4764627054242],[14.143478693321331,45.47574450303199],[14.141312556183617,45.475699615382474],[14.137853202844283,45.47567717155772],[14.134749483960396,45.47581183450626],[14.132066076128364,45.47641780133634],[14.132066060342034,45.47641781777468],[14.130675892391118,45.47697889695525],[14.130675852925293,45.4769789133936],[14.127475142826283,45.477742003435324],[14.124274432727272,45.47886419467316],[14.12223761720972,45.479380402642555],[14.119748176021602,45.48070458830
|
||
|
response.data.features.push(kocevje_bg);
|
||
|
response.data.features.push(cisko_2);
|
||
|
response.data.features.sort(compareFeatures);
|
||
|
return response;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// sort features so that dialect groups are first (send to back), dialects in the middle, subdialects last (on top)
|
||
|
// because we can not style with z-index svg graphics
|
||
|
function compareFeatures(a,b){
|
||
|
a = a.properties.id;
|
||
|
b = b.properties.id;
|
||
|
|
||
|
if(a.indexOf('_skupina') > -1 && b.indexOf('_skupina') > -1){ return 0; } //aa
|
||
|
if(a.indexOf('_narecje') > -1 && b.indexOf('_narecje') > -1){ return 0; } //bb
|
||
|
if(a.indexOf('_podnarecje') > -1 && b.indexOf('_podnarecje') > -1){ return 0; } //cc
|
||
|
if(a.indexOf('_skupina') > -1){ return -1; } // ab, ac
|
||
|
if(a.indexOf('_podnarecje') > -1){ return 1; } // ca, cb
|
||
|
if(a.indexOf('_narecje') > -1 && b.indexOf('_skupina') > -1){ return 1; } // ba
|
||
|
if(a.indexOf('_narecje') > -1 && b.indexOf('_podnarecje') > -1){ return -1; } // bc
|
||
|
if(a.indexOf('_govori') > -1){ return 1; }
|
||
|
if(b.indexOf('_govori') > -1){ return -1; }
|
||
|
}
|
||
|
|
||
|
function getDialectGroups(){
|
||
|
return getAll().then(function(response){
|
||
|
var features = response.data.features;
|
||
|
var dialectGroups = _.filter(features, function(feature){
|
||
|
return feature.properties.id.indexOf('narecna_skupina') > -1;
|
||
|
});
|
||
|
return dialectGroups;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}]);
|