예제 #1
0
        private void HandGetInstanceList(HttpContext context)
        {
            IVectorMapServerEnvironment env = VectorMapServerEnironment.GetInstance(_cnfgFile);

            if (env != null)
            {
                InstanceIdentify[] ids = env.GetAllServerInstances();
                WriteObjectToResponseStream(ids as object, context);
            }
        }
예제 #2
0
        private void HandGetFetClassProperty(HttpContext context, string instanceId, string fetclassId)
        {
            IVectorMapServerEnvironment env = VectorMapServerEnironment.GetInstance(_cnfgFile);

            if (env != null)
            {
                FetClassProperty pro = env.GetFetClassProperty(int.Parse(instanceId), fetclassId);
                WriteObjectToResponseStream(pro, context);
            }
        }
예제 #3
0
        private void HandReadGrid(HttpContext context, HttpRequest req)
        {
            string instanceId = req.Params[HttpCommands.cstArgInstanceId];
            string fetclassId = req.Params[HttpCommands.cstArgFetClassId];
            double minx       = double.Parse(req.Params[HttpCommands.cstArgMinX]);
            double maxx       = double.Parse(req.Params[HttpCommands.cstArgMaxX]);
            double miny       = double.Parse(req.Params[HttpCommands.cstArgMinY]);
            double maxy       = double.Parse(req.Params[HttpCommands.cstArgMaxY]);
            IVectorMapServerEnvironment env = VectorMapServerEnironment.GetInstance(_cnfgFile);

            if (env != null)
            {
                Feature[] features = env.ReadFeatures(int.Parse(instanceId), fetclassId, new Envelope(minx, miny, maxx, maxy));
                if (features == null)
                {
                    features = new Feature[] { }
                }
                ;
                WriteObjectToResponseStream(features, context);
            }
        }
예제 #4
0
        private void HandGetCatalogForInstance(HttpContext context, string instanceId)
        {
            if (instanceId == null)
            {
                throw new Exception(HttpCommands.cstErrorArgInstanceIdIsMissing);
            }
            int id = -1;

            if (!int.TryParse(instanceId, out id))
            {
                throw new Exception(string.Format(HttpCommands.cstErrorInstanceIsNotExisted, instanceId));
            }
            IVectorMapServerEnvironment env = VectorMapServerEnironment.GetInstance(_cnfgFile);

            if (env != null)
            {
                FetDatasetIdentify[] fetdsIds = null;
                FetClassIdentify[]   fetcIds  = null;
                env.GetCatalogsByInstanceId(id, out fetdsIds, out fetcIds);
                object[] args = new object[] { fetdsIds, fetcIds };
                WriteObjectToResponseStream(args as object, context);
            }
        }
예제 #5
0
        private void HandEndRead(HttpContext context, HttpRequest req)
        {
            string instanceId = req.Params[HttpCommands.cstArgInstanceId];
            string fetclassId = req.Params[HttpCommands.cstArgFetClassId];
            IVectorMapServerEnvironment env = VectorMapServerEnironment.GetInstance(_cnfgFile);

            if (env != null)
            {
                try
                {
                    env.BeginRead(int.Parse(instanceId), fetclassId);
                    WriteObjectToResponseStream(new RequestIsOK(), context);
                }
                catch (Exception ex)
                {
                    Log.WriterException(ex);
                    WriteObjectToResponseStream(new RequestIsFailed("尝试结束按网格读取要素失败。"), context);
                }
            }
            else
            {
                WriteObjectToResponseStream(new RequestIsFailed("获取IVectorMapServerEnvironment失败。"), context);
            }
        }