コード例 #1
0
ファイル: PlotterThread.cs プロジェクト: ackratos/USTCMap
        public PlotterThread(CacheManager cm)
        {
            this.cm = cm;
            //this.tileSize = context.getResources().getDisplayMetrics().densityDpi;
            this.tileSize = 199;
            this.dm = new DataManager();
            this.mapPlotter = new MapPlotter(tileSize);
            this.labelPlotter = new LabelPlotter();
            this.labelCache = new Cache<int, Tile>(LABEL_CACHE_CAPACITY);

            _thread = new Thread(run);
            _thread.Start();
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: ackratos/USTCMap
        // 构造函数
        public MainPage()
        {
            InitializeComponent();

            this.lat = 0.0;
            this.lon = 0.0;
            this.zoomlevel = MIN_ZOOM_LEVEL;
            this.targetZoomLevel = 19;
            this.scale = 1;
            this.threshold = getDPI() * 0.06f;

            this.hasTarget = false;
            this.isTracking = false;
            this.hasPosition = false;

            plotterHelper = new PlotterHelper();
            westCampus = new iustc.map.data.Rectangle(31.836497, 31.844080, 117.245445, 117.255058);
            eastCamput = new iustc.map.data.Rectangle(31.834236, 31.844189, 117.258920, 117.267889);
            arrowUri = new Uri("/iUSTCMap;component/resources/map_location_arrow.png", UriKind.Relative);
            dotUri = new Uri("/iUSTCMap;component/resources/map_location_dot.png", UriKind.Relative);
            arrowBitmap = new BitmapImage(arrowUri);
            dotBitmap = new BitmapImage(dotUri);

            if (cm == null)
                cm = new CacheManager(CACHE_CAPACITY, this);
            if (pThread == null)
                pThread = new PlotterThread(cm);

            watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); // using high accuracy

            LayoutRoot.Background = new SolidColorBrush(Color.FromArgb(255, 236, 236, 236));

            isoFile = IsolatedStorageFile.GetUserStoreForApplication();
            if (!isoFile.DirectoryExists("cache"))
            {
                isoFile.CreateDirectory("cache");
            }
            #region appBar
            appBar = new ApplicationBar();
            appBar.Opacity = 0.5;
            locateButton = new ApplicationBarIconButton(new Uri("resources/appbar.locate.rest.png", UriKind.Relative));
            locateButton.Text = "定位";
            locateButton.Click += new EventHandler(locateButton_Click);
            appBar.Buttons.Add(locateButton);

            zoomInButton = new ApplicationBarIconButton(new Uri("resources/appbar.new.rest.png", UriKind.Relative));
            zoomInButton.Text = "放大";
            zoomInButton.Click += new EventHandler(zoomInButton_Click);
            appBar.Buttons.Add(zoomInButton);

            zoomOutButton = new ApplicationBarIconButton(new Uri("resources/appbar.minus.rest.png", UriKind.Relative));
            zoomOutButton.Text = "缩小";
            zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
            appBar.Buttons.Add(zoomOutButton);

            selectCampusButton = new ApplicationBarIconButton(new Uri("resources/appbar.east.rest.png", UriKind.Relative));
            selectCampusButton.Text = "东校区";
            selectCampusButton.Click += new EventHandler(selectCampusButton_Click);
            appBar.Buttons.Add(selectCampusButton);

            ApplicationBar = appBar;
            #endregion
        }