Commit fe2a780a by niuxiaolin

latest

parent 162525e4
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
wwwroot/*.js
node_modules
typings
dist
2.4.8-SNAPSHOT
\ No newline at end of file
/**
* 一直覆盖在当前地图视野的Canvas对象
*
* @author nikai (@胖嘟嘟的骨头, nikai@baidu.com)
*
* @param
* {
* map 地图实例对象
* }
*/
function CanvasLayer(options){
this.options = options || {};
this.paneName = this.options.paneName || 'labelPane';
this.zIndex = this.options.zIndex || 0;
this._map = options.map;
this._lastDrawTime = null;
this.show();
}
CanvasLayer.prototype = new BMap.Overlay();
CanvasLayer.prototype.initialize = function(map){
this._map = map;
var canvas = this.canvas = document.createElement("canvas");
canvas.style.cssText = "position:absolute;"
+ "left:0;"
+ "top:0;"
+ "z-index:" + this.zIndex + ";";
this.adjustSize();
map.getPanes()[this.paneName].appendChild(canvas);
var that = this;
map.addEventListener('resize', function () {
that.adjustSize();
that._draw();
});
return this.canvas;
}
CanvasLayer.prototype.adjustSize = function(){
var size = this._map.getSize();
var canvas = this.canvas;
canvas.width = size.width;
canvas.height = size.height;
canvas.style.width = canvas.width + "px";
canvas.style.height = canvas.height + "px";
}
CanvasLayer.prototype.draw = function(){
if (!this._lastDrawTime || new Date() - this._lastDrawTime > 10) {
this._draw();
}
this._lastDrawTime = new Date();
}
CanvasLayer.prototype._draw = function(){
var map = this._map;
var size = map.getSize();
var center = map.getCenter();
if (center) {
var pixel = map.pointToOverlayPixel(center);
this.canvas.style.left = pixel.x - size.width / 2 + 'px';
this.canvas.style.top = pixel.y - size.height / 2 + 'px';
this.dispatchEvent('draw');
this.options.update && this.options.update.call(this);
}
}
CanvasLayer.prototype.getContainer = function(){
return this.canvas;
}
CanvasLayer.prototype.show = function(){
if (!this.canvas) {
this._map.addOverlay(this);
}
this.canvas.style.display = "block";
}
CanvasLayer.prototype.hide = function(){
this.canvas.style.display = "none";
//this._map.removeOverlay(this);
}
CanvasLayer.prototype.setZIndex = function(zIndex){
this.canvas.style.zIndex = zIndex;
}
CanvasLayer.prototype.getZIndex = function(){
return this.zIndex;
}
# Map
## @
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.9.
### swagger api
```
java -jar .\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://localhost:8080/v2/api-docs -l typescript-angular -o D:\projects\map
```
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
### publishing
## Code scaffolding
First build the package than run ```npm publish```
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
### consuming
## Build
Navigate to the folder of your consuming project and run one of next commands.
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
_published:_
## Running unit tests
```
npm install @ --save
```
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
_without publishing (not recommended):_
## Running end-to-end tests
```
npm install PATH_TO_GENERATED_PACKAGE --save
```
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
_using `npm link`:_
## Further help
In PATH_TO_GENERATED_PACKAGE:
```
npm link
```
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
In your project:
```
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
```
// without configuring providers
import { ApiModule } from '';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '';
export function apiConfigFactory (): Configuration => {
const params: ConfigurationParameters = {
// set configuration parameters here.
}
return new Configuration(params);
}
@NgModule({
imports: [ ApiModule.forRoot(apiConfigFactory) ],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
import { DefaultApi } from '';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple swagger files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different swagger files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
})
export class AppModule {
}
```
### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
```
import { BASE_PATH } from '';
bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);
```
or
```
import { BASE_PATH } from '';
@NgModule({
imports: [],
declarations: [ AppComponent ],
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```
\ No newline at end of file
......@@ -13,6 +13,7 @@
"style": "less"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
......@@ -29,7 +30,10 @@
"styles": [
"src/styles.less"
],
"scripts": [],
"scripts":[
],
"es5BrowserSupport": true
},
"configurations": {
......@@ -64,6 +68,7 @@
"options": {
"browserTarget": "map:build"
},
"configurations": {
"production": {
"browserTarget": "map:build:production"
......
This diff is collapsed. Click to expand it.
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
......@@ -121,14 +121,6 @@
"rxjs": "6.3.3"
}
},
"@angular/animations": {
"version": "7.2.15",
"resolved": "https://registry.npm.taobao.org/@angular/animations/download/@angular/animations-7.2.15.tgz",
"integrity": "sha1-mAwfUjp51LfLRFCPV/ugby4Icvo=",
"requires": {
"tslib": "^1.9.0"
}
},
"@angular/cli": {
"version": "7.3.9",
"resolved": "https://registry.npm.taobao.org/@angular/cli/download/@angular/cli-7.3.9.tgz?cache=0&sync_timestamp=1563411123554&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40angular%2Fcli%2Fdownload%2F%40angular%2Fcli-7.3.9.tgz",
......@@ -997,6 +989,14 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true
},
"angular2-baidu-map": {
"version": "4.7.0",
"resolved": "https://registry.npm.taobao.org/angular2-baidu-map/download/angular2-baidu-map-4.7.0.tgz",
"integrity": "sha1-6xZRqjqd5subXXbbKErtHyJRGs0=",
"requires": {
"tslib": "^1.7.1"
}
},
"ansi-colors": {
"version": "3.2.4",
"resolved": "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-3.2.4.tgz",
......
......@@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --proxy--config proxy.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
......@@ -11,7 +11,6 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
......@@ -19,6 +18,7 @@
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"angular2-baidu-map": "^4.7.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
......
[
{
"context": [
"/project",
"/scetion",
"/course",
"/camera"
],
"target": "http://localhost:8080",
"secure": false
}
]
\ No newline at end of file
wwwroot/*.js
node_modules
typings
dist
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
2.4.8-SNAPSHOT
\ No newline at end of file
## @
### Building
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
```
### publishing
First build the package than run ```npm publish```
### consuming
Navigate to the folder of your consuming project and run one of next commands.
_published:_
```
npm install @ --save
```
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
```
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE:
```
npm link
```
In your project:
```
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
```
// without configuring providers
import { ApiModule } from '';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '';
export function apiConfigFactory (): Configuration => {
const params: ConfigurationParameters = {
// set configuration parameters here.
}
return new Configuration(params);
}
@NgModule({
imports: [ ApiModule.forRoot(apiConfigFactory) ],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
import { DefaultApi } from '';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple swagger files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different swagger files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
})
export class AppModule {
}
```
### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
```
import { BASE_PATH } from '';
bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);
```
or
```
import { BASE_PATH } from '';
@NgModule({
imports: [],
declarations: [ AppComponent ],
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```
\ No newline at end of file
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
import { DefaultService } from './api/default.service';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [
DefaultService ]
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}
export * from './default.service';
import { DefaultService } from './default.service';
export const APIS = [DefaultService];
export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
}
export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
constructor(configurationParameters: ConfigurationParameters = {}) {
this.apiKeys = configurationParameters.apiKeys;
this.username = configurationParameters.username;
this.password = configurationParameters.password;
this.accessToken = configurationParameters.accessToken;
this.basePath = configurationParameters.basePath;
this.withCredentials = configurationParameters.withCredentials;
}
/**
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
return undefined;
}
let type = contentTypes.find(x => this.isJsonMime(x));
if (type === undefined) {
return contentTypes[0];
}
return type;
}
/**
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
return undefined;
}
let type = accepts.find(x => this.isJsonMime(x));
if (type === undefined) {
return accepts[0];
}
return type;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}
import { HttpUrlEncodingCodec } from '@angular/common/http';
/**
* CustomHttpUrlEncodingCodec
* Fix plus sign (+) not encoding, so sent as blank space
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318
*/
export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec {
encodeKey(k: string): string {
k = super.encodeKey(k);
return k.replace(/\+/gi, '%2B');
}
encodeValue(v: string): string {
v = super.encodeValue(v);
return v.replace(/\+/gi, '%2B');
}
}
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
export * from './api/api';
export * from './model/models';
export * from './variables';
export * from './configuration';
export * from './api.module';
\ No newline at end of file
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Camera {
coordinate?: string;
delFlag?: number;
id?: number;
name?: string;
section?: number;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Course {
delFlag?: number;
id?: number;
lineStyle?: string;
lineWidth?: number;
mark?: number;
name?: string;
coordinate?:string;
}
export * from './camera';
export * from './course';
export * from './project';
export * from './resultBeanCamera';
export * from './resultBeanCourse';
export * from './resultBeanListCamera';
export * from './resultBeanListCourse';
export * from './resultBeanListProject';
export * from './resultBeanListScetion';
export * from './resultBeanProject';
export * from './resultBeanScetion';
export * from './resultBeandouble';
export * from './resultBeanint';
export * from './scetion';
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Project {
capital?: number;
coordinate?: string;
course?: number;
delFlag?: number;
id?: number;
lineStyle?: string;
lineWidth?: number;
mileage?: number;
name?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Camera } from './camera';
export interface ResultBeanCamera {
code?: number;
data?: Camera;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Course } from './course';
export interface ResultBeanCourse {
code?: number;
data?: Course;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Camera } from './camera';
export interface ResultBeanListCamera {
code?: number;
data?: Array<Camera>;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Course } from './course';
export interface ResultBeanListCourse {
code?: number;
data?: Array<Course>;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Project } from './project';
export interface ResultBeanListProject {
code?: number;
data?: Array<Project>;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Scetion } from './scetion';
export interface ResultBeanListScetion {
code?: number;
data?: Array<Scetion>;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Project } from './project';
export interface ResultBeanProject {
code?: number;
data?: Project;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Scetion } from './scetion';
export interface ResultBeanScetion {
code?: number;
data?: Scetion;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ResultBeandouble {
code?: number;
data?: number;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ResultBeanint {
code?: number;
data?: number;
msg?: string;
}
/**
* 智慧监控平台文档
* 简单优雅的风格
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Scetion {
coordinate?: string;
delFlag?: number;
id?: number;
lineStyle?: string;
lineWidth?: number;
mileage?: number;
name?: string;
project?: number;
}
import { InjectionToken } from '@angular/core';
export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { MainComponent } from './main/main.component';
import { VideoComponent } from './video/video.component';
const routes: Routes = [];
const routes: Routes = [
{path:"",redirectTo:"./home",pathMatch:'full'},
{path:'home',component:MainComponent},
{path:'video',component:VideoComponent},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
......
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
<h1>
山西省公路建设智慧监管指挥平台
</h1>
<router-outlet></router-outlet>
h1{
text-align: center;
}
\ No newline at end of file
......@@ -3,14 +3,27 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MainComponent } from './main/main.component';
import { VideoComponent } from './video/video.component';
import { BaiduMapModule } from 'angular2-baidu-map';
import { FormsModule } from '@angular/forms';
import { ModalComponent } from './modal/modal.component';
import { ApiModule } from './api';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
AppComponent,
MainComponent,
VideoComponent,
ModalComponent
],
imports: [
HttpClientModule,
BrowserModule,
AppRoutingModule
AppRoutingModule,
FormsModule,
ApiModule,
BaiduMapModule.forRoot({ ak: 'KhQqnL3owyAzqjr4zCGbWiiHwPFmKTD6' })
],
providers: [],
bootstrap: [AppComponent]
......
import { TestBed } from '@angular/core/testing';
import { DynamicScriptService } from './dynamic-script.service';
describe('DynamicScriptService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: DynamicScriptService = TestBed.get(DynamicScriptService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
interface Scripts {
name: string;
src: string;
}
export const ScriptStore: Scripts[] = [
{ name: 'drawing', src: '/assets/DrawingManager.js' },
{ name: 'geouti', src: '/assets/GeoUtils.js' },
];
declare var document: any;
@Injectable({
providedIn:'root'
})
export class DynamicScriptLoaderService {
private scripts: any = {};
constructor() {
ScriptStore.forEach((script: any) => {
this.scripts[script.name] = {
loaded: false,
src: script.src
};
});
}
load(...scripts: string[]) {
const promises: any[] = [];
scripts.forEach((script) => promises.push(this.loadScript(script)));
return Promise.all(promises);
}
loadScript(name: string) {
return new Promise((resolve, reject) => {
if (!this.scripts[name].loaded) {
//load script
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = this.scripts[name].src;
if (script.readyState) { //IE
script.onreadystatechange = () => {
if (script.readyState === "loaded" || script.readyState === "complete") {
script.onreadystatechange = null;
this.scripts[name].loaded = true;
resolve({script: name, loaded: true, status: 'Loaded'});
}
};
} else { //Others
script.onload = () => {
this.scripts[name].loaded = true;
resolve({script: name, loaded: true, status: 'Loaded'});
};
}
script.onerror = (error: any) => resolve({script: name, loaded: false, status: 'Loaded'});
document.getElementsByTagName('head')[0].appendChild(script);
} else {
resolve({ script: name, loaded: true, status: 'Already Loaded' });
}
});
}
}
\ No newline at end of file
<header></header>
<div class="main">
<div class="left">
<section>
<select [(ngModel)]="type">
<option value="0">project</option>
<option value="1">course</option>
<option value="2">SECTION</option>
</select>
<select [(ngModel)]="currentCouseId">
<option *ngFor="let c of courses" [value]="c.id" >{{c.name}}</option>
</select>
<!-- <button (click)="openDialog('custom-modal-1')" >新增项目</button> -->
<button (click)="toHighWay()">高速公路</button>
<div *ngIf="!highShow">
<label>项目总数:{{staticHighWay.total}}个</label>
<label>总建设里程:{{staticHighWay.mileage}}Km </label>
<label>总投资:{{staticHighWay.capital}}亿</label>
</div>
<section *ngIf="highShow" class="sub">
<label (click)="changePolyline(prj)" *ngFor="let prj of projects">{{prj.name}}
</label>
</section>
</section>
<section>
<button (click)='toNormal()'>普通干线
</button>
<div *ngIf="!normalShow">
<label>项目总数:{{staticNormal.total}}个</label>
<label>总建设里程:{{staticNormal.mileage}}Km </label>
<label>总投资:{{staticNormal.capital}}亿</label>
</div>
<section *ngIf="normalShow" class="sub">
<label (click)="changePolyline(prj)" *ngFor="let prj of normalProjects">{{prj.name}}
</label>
</section>
</section>
</div>
<div class="map">
<div id="polylineLength"></div>
<div id="result"></div>
<!-- <polyline *ngFor="let poly of polys" [points]="poly.points" [options]="poly.polylineOptions" (loaded)="polylineLoaded($event)" (clicked)="polylineClicked($event)"></polyline>
-->
<baidu-map #map [options]="opts" >
<polyline [points]="points" [options]="polylineOptions" (loaded)="polylineLoaded($event)" (clicked)="polylineClicked($event)"></polyline>
</baidu-map>
</div>
<div class="right">
<section>
<button>视频监管
</button>
<label>项目总数:**个</label>
<label>总建设里程:***Km </label>
<label>总投资:**亿</label>
</section>
<section>
<button>建设程序监管
</button>
<label>项目总数:**个</label>
<label>总建设里程:***Km </label>
<label>总投资:**亿</label>
</section>
<section>
<button>质量安全监管
</button>
<label>项目总数:**个</label>
<label>总建设里程:***Km </label>
<label>总投资:**亿</label>
</section>
<section>
<button>造价监管
</button>
<label>项目总数:**个</label>
<label>总建设里程:***Km </label>
<label>总投资:**亿</label>
</section>
</div>
</div>
<jw-modal id="custom-modal-1">
<h1>添加项目</h1>
<p>项目名称: <input type="text" [(ngModel)]="proj.name" /></p>
<p>capital: <input type="text" [(ngModel)]="proj.capital" /></p>
<p>coordinate: <input type="text" [(ngModel)]="proj.coordinate" /></p>
<p>course: <input type="text" [(ngModel)]="proj.course" /></p>
<p>lineStyle: <input type="text" [(ngModel)]="proj.lineStyle" /></p>
<p>lineWidth: <input type="text" [(ngModel)]="proj.lineWidth" /></p>
<p>mileage: <input type="text" [(ngModel)]="proj.mileage" /></p>
<button (click)="addProj(proj)">添加</button>
<button (click)="closeModal('custom-modal-1');">Close</button>
</jw-modal>
<jw-modal id="custom-modal-2">
<h1>添加course</h1>
<p>courses名称: <input type="text" [(ngModel)]="course.name" /></p>
<p>lineStyle: <input type="text" [(ngModel)]="course.lineStyle" /></p>
<p>lineWidth: <input type="text" [(ngModel)]="course.lineWidth" /></p>
<p>coordinate: <input type="text" [(ngModel)]="course.coordinate" /></p>
<p>mark:
<select [(ngModel)]="course.mark" >
<option [value]="1">高速公路</option>
<option [value]="2">普通干线</option>
</select>
</p>
<button (click)="addCourse(course)">添加</button>
<button (click)="closeModal('custom-modal-2');">Close</button>
</jw-modal>
<jw-modal id="custom-modal-3">
<h1>添加section</h1>
<p>courses名称: <input type="text" [(ngModel)]="section.name" /></p>
<p>projectId: <input type="text" [(ngModel)]="section.project" /></p>
<p>lineStyle: <input type="text" [(ngModel)]="section.lineStyle" /></p>
<p>lineWidth: <input type="text" [(ngModel)]="section.lineWidth" /></p>
<p>coordinate: <input type="text" [(ngModel)]="section.coordinate" /></p>
<p>coordinate: <input type="text" [(ngModel)]="section.mileage" /></p>
<button (click)="addSection(section)">添加</button>
<button (click)="closeModal('custom-modal-3');">Close</button>
</jw-modal>
.main{
display: grid;
grid-template-columns: 15% auto 15%;
grid-template-rows:850px;
section{
padding: 1em;
background: #3885b391;
margin: 5px;
border: 4px solid #3885b3;
button{
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
background: #ea262d96;
color:white;
border-radius: 4px;
width: 100px;
height: 30px;
display: block;
margin: 0.3em;
}
label{
display: block;
}
&.sub{
padding:0.4em;
border:none;
margin:0;
label{
cursor: pointer;
background: #076796;
padding: 0.2em;
border: 1px solid #42a5d23b;
}
}
}
.left{
}
.map{
}
.right{
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MainComponent } from './main.component';
describe('MainComponent', () => {
let component: MainComponent;
let fixture: ComponentFixture<MainComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MainComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MainComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/* MODAL STYLES
-------------------------------*/
jw-modal {
/* modals are hidden by default */
display: none;
.jw-modal {
/* modal container fixed across whole screen */
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/* z-index must be higher than .jw-modal-background */
z-index: 1000;
/* enables scrolling for tall modals */
overflow: auto;
.jw-modal-body {
padding: 20px;
background: #fff;
/* margin exposes part of the modal background */
margin: 40px;
}
}
.jw-modal-background {
/* modal background fixed across whole screen */
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/* semi-transparent black */
background-color: #000;
opacity: 0.75;
/* z-index must be below .jw-modal and above everything else */
z-index: 900;
}
}
body.jw-modal-open {
/* body overflow is hidden to hide main scrollbar when modal window is open */
overflow: hidden;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ModalComponent } from './modal.component';
describe('ModalComponent', () => {
let component: ModalComponent;
let fixture: ComponentFixture<ModalComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ModalComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, ElementRef, Input, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { ModalService } from '../services';
@Component({
selector: 'jw-modal',
template:
`<div class="jw-modal">
<div class="jw-modal-body">
<ng-content></ng-content>
</div>
</div>
<div class="jw-modal-background"></div>`,
styleUrls:[
"./modal.component.less"
]
})
export class ModalComponent implements OnInit, OnDestroy {
@Input() id: string;
private element: any;
constructor(private modalService: ModalService, private el: ElementRef) {
this.element = el.nativeElement;
}
ngOnInit(): void {
let modal = this;
// ensure id attribute exists
if (!this.id) {
console.error('modal must have an id');
return;
}
// move element to bottom of page (just before </body>) so it can be displayed above everything else
document.body.appendChild(this.element);
// close modal on background click
this.element.addEventListener('click', function (e: any) {
if (e.target.className === 'jw-modal') {
modal.close();
}
});
// add self (this modal instance) to the modal service so it's accessible from controllers
this.modalService.add(this);
}
// remove self from modal service when directive is destroyed
ngOnDestroy(): void {
this.modalService.remove(this.id);
this.element.remove();
}
// open modal
open(): void {
this.element.style.display = 'block';
document.body.classList.add('jw-modal-open');
}
// close modal
close(): void {
this.element.style.display = 'none';
document.body.classList.remove('jw-modal-open');
}
}
\ No newline at end of file
export * from './modal.service';
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class ModalService {
private modals: any[] = [];
add(modal: any) {
// add modal to array of active modals
this.modals.push(modal);
}
remove(id: string) {
// remove modal from array of active modals
this.modals = this.modals.filter(x => x.id !== id);
}
open(id: string) {
// open modal specified by id
let modal: any = this.modals.filter(x => x.id === id)[0];
modal.open();
}
close(id: string) {
// close modal specified by id
let modal: any = this.modals.filter(x => x.id === id)[0];
modal.close();
}
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { VideoComponent } from './video.component';
describe('VideoComponent', () => {
let component: VideoComponent;
let fixture: ComponentFixture<VideoComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ VideoComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(VideoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-video',
templateUrl: './video.component.html',
styleUrls: ['./video.component.less']
})
export class VideoComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,8 +7,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
<style>
body{
background: rgb(66,187,250);
background: radial-gradient(circle, rgba(66,187,250,1) 20%, rgba(10,53,68,1) 100%);
color:white;
}
</style>
</head>
<body>
<app-root></app-root>
</body>
</html>
/* You can add global styles to this file, and also import other style files */
/* MODAL STYLES
-------------------------------*/
jw-modal {
/* modals are hidden by default */
display: none;
.jw-modal {
/* modal container fixed across whole screen */
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/* z-index must be higher than .jw-modal-background */
z-index: 1000;
/* enables scrolling for tall modals */
overflow: auto;
.jw-modal-body {
padding: 20px;
background: #fff;
color:black;
/* margin exposes part of the modal background */
margin: 400px;
}
}
.jw-modal-background {
/* modal background fixed across whole screen */
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
/* semi-transparent black */
background-color: #000;
opacity: 0.75;
/* z-index must be below .jw-modal and above everything else */
z-index: 900;
}
}
body.jw-modal-open {
/* body overflow is hidden to hide main scrollbar when modal window is open */
overflow: hidden;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment