ArcGIS Engine开发的ArcGIS 版本管理的功能
原文:ArcGIS Engine开发的ArcGIS 版本管理的功能
转自:http://blog.csdn.net/linghe301/article/details/7965901
这是以前的ArcGIS Engine开发成果,主要是Geodatabase方面的,模仿ArcGIS版本的流程
系统环境:
VS2010、ArcGIS Engine10、DevExpress721(第三方控件,比较常用易于下载)
------------------------------------------------------------------
我跟大家分享了存在#百度网盘#上的文件,“DXperienceEval-7.2.1.exe”,点击链接进行查看和下载。 http://t.cn/zWsdZRY (分享自 @百度网盘官方微博)
------------------------------------------------------------------
系统的连接参数都写在代码里面了,如果有问题,跟踪一下代码即可解决
相关功能:
1:打开ArcSDE版本数据
2:切换版本
3:创建新版本
4:查看版本信息
5:协调版本
6:冲突解决
7:提交版本
8:历史归档管理
因为这是很早的东西了,是自己兴趣开发的,会有相关bug,如果有一定基础肯定可以顺利的进行参考!希望能给大家带来帮助!
仅供参考!
下图为系统界面
下图为创建子版本
下图为协调版本
下图为冲突对话框
核心代码冲突对话框
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using ESRI.ArcGIS.Geometry;
- using ESRI.ArcGIS.Geodatabase;
- using ESRI.ArcGIS.esriSystem;
- using ESRI.ArcGIS.Display;
- using LSCommonHelper;
- using LSGISHelper;
- using ESRI.ArcGIS.DataSourcesGDB;
- using ESRI.ArcGIS.Controls;
- using ESRI.ArcGIS.Carto;
- using DevExpress.XtraGrid.Views.Grid;
- namespace LSVersion.Version
- {
- public partial class ConflictsForm : Form
- {
- public ConflictsForm()
- {
- InitializeComponent();
- }
- private IVersion m_peditVersion=null;
- public IVersion EditVersion
- {
- get { return m_peditVersion; }
- set { m_peditVersion = value; }
- }
- private IVersion m_ptargetVersion = null;
- public IVersion TargetVersion
- {
- get { return m_ptargetVersion; }
- set { m_ptargetVersion = value; }
- }
- private void ConflictsForm_Load(object sender, EventArgs e)
- {
- Init();
- }
- private IFeatureWorkspace featureWorkspace = null;
- private IFeatureWorkspace commonAncestorFWorkspace = null;
- private IFeatureWorkspace preReconcileFWorkspace = null;
- private IFeatureWorkspace reconcileFWorkspace = null;
- private AxMapControl m_pMapControl = null;
- public AxMapControl MapControl
- {
- get { return m_pMapControl; }
- set { m_pMapControl = value; }
- }
- IFeature featurePreReconcile = null;
- IFeature featureReconcile = null;
- IFeature featureCommonAncestor = null;
- private void ClickID(string sLayerName, int sOID, TreeNode sSelNode)
- {
- IFeatureClass featureClassPreReconcile =
- preReconcileFWorkspace.OpenFeatureClass(sLayerName);
- IFeatureClass featureClassReconcile =
- reconcileFWorkspace.OpenFeatureClass(sLayerName);
- IFeatureClass featureClassCommonAncestor =
- commonAncestorFWorkspace.OpenFeatureClass(sLayerName);
- this.axMapControl1.ClearLayers();
- this.axMapControl2.ClearLayers();
- this.axMapControl3.ClearLayers();
- this.listView1.Items.Clear();
- int flag = -1;
- if (sSelNode.Parent.Text == "更新-更新冲突")
- {
- flag = 0;
- }
- else if (sSelNode.Parent.Text == "删除-更新冲突")
- {
- flag = 1;
- }
- else if (sSelNode.Parent.Text == "更新-删除冲突")
- {
- flag = 2;
- }
- IFeatureLayer PreReconcileFL = new FeatureLayerClass();
- PreReconcileFL.FeatureClass = featureClassPreReconcile;
- IFeatureLayer ReconcileFL = new FeatureLayerClass();
- ReconcileFL.FeatureClass = featureClassReconcile;
- IFeatureLayer CommonAncestorFL = new FeatureLayerClass();
- CommonAncestorFL.FeatureClass = featureClassCommonAncestor;
- this.axMapControl1.Map.AddLayer(ReconcileFL as ILayer);
- this.axMapControl2.Map.AddLayer(PreReconcileFL as ILayer);
- this.axMapControl3.Map.AddLayer(CommonAncestorFL as ILayer);
- try
- {
- featurePreReconcile =
- featureClassPreReconcile.GetFeature(sOID);
- }
- catch { this.axMapControl2.ClearLayers(); }
- try
- {
- featureReconcile = featureClassReconcile.GetFeature(sOID);
- }
- catch { this.axMapControl1.ClearLayers(); }
- try
- {
- featureCommonAncestor =
- featureClassCommonAncestor.GetFeature(sOID);
- }
- catch { this.axMapControl3.ClearLayers(); }
- IField pField = null;
- if (flag == 0)
- {
- for (int i = 0; i < featureReconcile.Fields.FieldCount; i++)
- {
- pField = featureReconcile.Fields.get_Field(i);
- ListViewItem lv = new ListViewItem();
- lv.SubItems.Add(pField.AliasName);
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featurePreReconcile, pField.AliasName));
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureCommonAncestor, pField.AliasName));
- this.listView1.Items.Add(lv);
- }
- }
- else if (flag == 1)
- {
- for (int i = 0; i < featureReconcile.Fields.FieldCount; i++)
- {
- pField = featureReconcile.Fields.get_Field(i);
- ListViewItem lv = new ListViewItem();
- lv.SubItems.Add(pField.AliasName);
- if (i == 0)
- {
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add("Deleted");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureCommonAncestor, pField.AliasName));
- }
- else
- {
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add("");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureReconcile, pField.AliasName));
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureCommonAncestor, pField.AliasName));
- }
- this.listView1.Items.Add(lv);
- }
- }
- else if (flag == 2)
- {
- for (int i = 0; i < featurePreReconcile.Fields.FieldCount; i++)
- {
- pField = featurePreReconcile.Fields.get_Field(i);
- ListViewItem lv = new ListViewItem();
- lv.SubItems.Add(pField.AliasName);
- if (i == 0)
- {
- lv.SubItems.Add("Deleted");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featurePreReconcile, pField.AliasName));
- lv.SubItems.Add("Deleted");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureCommonAncestor, pField.AliasName));
- }
- else
- {
- lv.SubItems.Add("");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featurePreReconcile, pField.AliasName));
- lv.SubItems.Add("");
- lv.SubItems.Add(LSGISHelper.FeatureHelper.GetFeatureStringValue(featureCommonAncestor, pField.AliasName));
- }
- this.listView1.Items.Add(lv);
- }
- }
- Flash(this.axMapControl1, featureReconcile);
- Flash(this.axMapControl2, featurePreReconcile);
- Flash(this.axMapControl3, featureCommonAncestor);
- #region//Display
- pageCon = this.m_pMapControl.ActiveView.GraphicsContainer;
- pageCon.DeleteAllElements();
- Display(featureReconcile);
- Display(featurePreReconcile);
- Display(featureCommonAncestor);
- #endregion
- }
- IGraphicsContainer pageCon = null;
- private void Display(IFeature pFea)
- {
- IFillShapeElement pPEle = new PolygonElementClass();
- IFillSymbol pFillSym = new SimpleFillSymbolClass();
- RgbColorClass rgbClr = new RgbColorClass();
- rgbClr.Transparency = 0;
- ILineSymbol pLineSym = new SimpleLineSymbolClass();
- pLineSym.Color = LSGISHelper.ColorHelper.CreateRandomColor();
- pLineSym.Width = 4;
- pFillSym.Color = rgbClr;
- pFillSym.Outline = pLineSym;
- pPEle.Symbol = pFillSym;
- IElement pEle = pPEle as IElement;
- pEle.Geometry = pFea.ShapeCopy;
- this.m_pMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
- pageCon.AddElement(pEle, 0);
- }
- private void Flash(AxMapControl axMapControl3, IFeature pFea)
- {
- if (pFea != null)
- {
- axMapControl3.Extent = pFea.Shape.Envelope;
- axMapControl3.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
- axMapControl3.FlashShape(pFea.ShapeCopy);
- }
- }
- private void Init()
- {
- this.myTreeView1.Nodes.Clear();
- this.listView1.Items.Clear();
- try
- {
- IWorkspaceEdit workspaceEdit = (IWorkspaceEdit2)m_peditVersion;
- IVersionEdit4 versionEdit4 = (IVersionEdit4)workspaceEdit;
- featureWorkspace = m_peditVersion as IFeatureWorkspace;
- // Get the various versions on which to output information.
- commonAncestorFWorkspace = (IFeatureWorkspace)
- versionEdit4.CommonAncestorVersion;
- preReconcileFWorkspace = (IFeatureWorkspace)
- versionEdit4.PreReconcileVersion;
- reconcileFWorkspace = (IFeatureWorkspace)
- versionEdit4.ReconcileVersion;
- IEnumConflictClass enumConflictClass = versionEdit4.ConflictClasses;
- TreeNode pRootNode = new TreeNode();
- pRootNode.Text = "Conflicts";
- this.myTreeView1.Nodes.Add(pRootNode);
- IConflictClass conflictClass = null;
- while ((conflictClass = enumConflictClass.Next()) != null)
- {
- IDataset dataset = (IDataset)conflictClass;
- // Make sure class is a feature class.
- if (dataset.Type == esriDatasetType.esriDTFeatureClass)
- {
- String datasetName = dataset.Name;
- TreeNode pRoot2Node = new TreeNode();
- pRoot2Node.Text = datasetName;
- this.myTreeView1.Nodes[0].Nodes.Add(pRoot2Node);
- IFeatureClass featureClass = featureWorkspace.OpenFeatureClass
- (datasetName);
- // Console.WriteLine("Conflicts on feature class {0}", datasetName);
- // Get conflict feature classes on the three reconcile versions.
- // Get all UpdateUpdate conflicts.
- ISelectionSet updateUpdates = conflictClass.UpdateUpdates;
- if (updateUpdates.Count > 0)
- {
- TreeNode pUUNode = new TreeNode();
- pUUNode.Text = "更新-更新冲突";
- pRoot2Node.Nodes.Add(pUUNode);
- #region 更新更新
- // Iterate through each OID, outputting information.
- IEnumIDs enumIDs = updateUpdates.IDs;
- int oid = enumIDs.Next();
- while (oid != -1)
- //loop through all conflicting features
- {
- // Console.WriteLine("UpdateUpdate conflicts on feature {0}", oid);
- // Get conflict feature on the three reconcile versions.
- TreeNode pOidNode = new TreeNode();
- pOidNode.Text ="OID:"+ oid.ToString();
- pUUNode.Nodes.Add(pOidNode);
- #region---处理
- // Check to make sure each shape is different than the common ancestor (conflict is on shape field).
- #endregion
- oid = enumIDs.Next();
- }
- #endregion
- }
- ISelectionSet deleteUpdates = conflictClass.DeleteUpdates;
- if (deleteUpdates.Count > 0)
- {
- TreeNode pDUNode = new TreeNode();
- pDUNode.Text = "删除-更新冲突";
- pRoot2Node.Nodes.Add(pDUNode);
- #region 删除更新
- // Iterate through each OID, outputting information.
- IEnumIDs enumIDs = deleteUpdates.IDs;
- int oid = enumIDs.Next();
- while (oid != -1)
- //loop through all conflicting features
- {
- // Console.WriteLine("UpdateUpdate conflicts on feature {0}", oid);
- // Get conflict feature on the three reconcile versions.
- TreeNode pOidNode = new TreeNode();
- pOidNode.Text = "OID:" + oid.ToString();
- pDUNode.Nodes.Add(pOidNode);
- oid = enumIDs.Next();
- }
- #endregion
- }
- ISelectionSet Updatedeletes = conflictClass.UpdateDeletes;
- if (Updatedeletes.Count > 0)
- {
- TreeNode pUDNode = new TreeNode();
- pUDNode.Text = "更新-删除冲突";
- pRoot2Node.Nodes.Add(pUDNode);
- #region 更新删除
- // Iterate through each OID, outputting information.
- IEnumIDs enumIDs = Updatedeletes.IDs;
- int oid = enumIDs.Next();
- while (oid != -1)
- //loop through all conflicting features
- {
- TreeNode pOidNode = new TreeNode();
- pOidNode.Text = "OID:" + oid.ToString();
- pUDNode.Nodes.Add(pOidNode);
- oid = enumIDs.Next();
- }
- #endregion
- }
- }
- }
- this.myTreeView1.ExpandAll();
- }
- catch (System.Runtime.InteropServices.COMException comExc)
- {
- Console.WriteLine("Error Message: {0}, Error Code: {1}", comExc.Message,
- comExc.ErrorCode);
- }
- }
- // Method to determine if shape field is in conflict.
- private bool IsShapeInConflict(IFeature commonAncestorFeature, IFeature
- preReconcileFeature, IFeature reconcileFeature)
- {
- // 1st check: Common Ancestor with PreReconcile.
- // 2nd check: Common Ancestor with Reconcile.
- // 3rd check: Reconcile with PreReconcile (case of same change on both versions)
- if (IsGeometryEqual(commonAncestorFeature.ShapeCopy,
- preReconcileFeature.ShapeCopy) || IsGeometryEqual
- (commonAncestorFeature.ShapeCopy, reconcileFeature.ShapeCopy) ||
- IsGeometryEqual(reconcileFeature.ShapeCopy, preReconcileFeature.ShapeCopy)
- )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- // Method returning if two shapes are equal to one another.
- private bool IsGeometryEqual(IGeometry shape1, IGeometry shape2)
- {
- if (shape1 == null & shape2 == null)
- {
- return true;
- }
- else if (shape1 == null ^ shape2 == null)
- {
- return false;
- }
- else
- {
- IClone clone1 = (IClone)shape1;
- IClone clone2 = (IClone)shape2;
- return clone1.IsEqual(clone2);
- }
- }
- private void myTreeView1_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (this.myTreeView1.Nodes.Count > 0)
- {
- TreeNode sSelNode = this.myTreeView1.SelectedNode;
- if (sSelNode != null)
- {
- string sSel = sSelNode.Text;
- if (LSCommonHelper.OtherHelper.GetLeftName(sSel, ":") == "OID")
- {
- string sLayerName = sSelNode.Parent.Parent.Text;
- int sOID = LSCommonHelper.ConvertHelper.ObjectToInt(
- LSCommonHelper.OtherHelper.GetRightName(sSel, ":"));
- ClickID(sLayerName, sOID, sSelNode);
- }
- }
- }
- }
- private void ConflictsForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- pageCon.DeleteAllElements();
- }
- private void replaceObjectWith(IFeature pfea,
- TreeNode pNode )
- {
- pageCon.DeleteAllElements();
- TreeNode sSelNode = this.myTreeView1.SelectedNode;
- if (sSelNode != null)
- {
- string sSel = sSelNode.Text;
- if (LSCommonHelper.OtherHelper.GetLeftName(sSel, ":") == "OID")
- {
- string sLayerName = sSelNode.Parent.Parent.Text;
- int sOID = LSCommonHelper.ConvertHelper.ObjectToInt(
- LSCommonHelper.OtherHelper.GetRightName(sSel, ":"));
- IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(sLayerName);
- IFeature feature = featureClass.GetFeature(sOID);
- feature.Shape = pfea.ShapeCopy;
- feature.Store();
- m_pMapControl.ActiveView.Refresh();
- }
- }
- }
- private TreeNode sSelNode = null;
- private void myTreeView1_MouseDown(object sender, MouseEventArgs e)
- {
- sSelNode = this.myTreeView1.GetNodeAt(e.X, e.Y);
- if (sSelNode == null) return;
- if (e.Button == MouseButtons.Left)
- {//左键
- }
- else
- {
- System.Drawing.Point aPt = new System.Drawing.Point(e.X, e.Y);
- // TreeNode sSelNode = this.myTreeView1.SelectedNode;
- if (sSelNode != null)
- {
- string sSel = sSelNode.Text;
- if (LSCommonHelper.OtherHelper.GetLeftName(sSel, ":") == "OID")
- {
- this.contextMenuStrip1.Show(this.myTreeView1, aPt);
- }
- }
- }
- }
- private void replaceObjectWithCommonAncestorVersionToolStripMenuItem_Click(object sender, EventArgs e)
- {
- replaceObjectWith(featureCommonAncestor, sSelNode);
- }
- private void replaceObjectWithPreReconcileVersionToolStripMenuItem_Click(object sender, EventArgs e)
- {
- replaceObjectWith(featurePreReconcile, sSelNode);
- }
- private void replaceObjectWithConflictsVersionToolStripMenuItem_Click(object sender, EventArgs e)
- {
- replaceObjectWith(featureReconcile, sSelNode);
- }
- private void mergeGeometryToolStripMenuItem_Click(object sender, EventArgs e)
- {
- MergeGeometry(featureCommonAncestor, featurePreReconcile, featureReconcile, sSelNode);
- }
- private void MergeGeometry(IFeature featureCommonAncestor
- , IFeature featurePreReconcile, IFeature featureReconcile,TreeNode pNode)
- {
- pageCon.DeleteAllElements();
- TreeNode sSelNode = this.myTreeView1.SelectedNode;
- if (sSelNode != null)
- {
- string sSel = sSelNode.Text;
- if (LSCommonHelper.OtherHelper.GetLeftName(sSel, ":") == "OID")
- {
- string sLayerName = sSelNode.Parent.Parent.Text;
- int sOID = LSCommonHelper.ConvertHelper.ObjectToInt(
- LSCommonHelper.OtherHelper.GetRightName(sSel, ":"));
- IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(sLayerName);
- // Check to make sure each shape is different than the common ancestor (conflict is on shape field).
- if (IsShapeInConflict(featureCommonAncestor,
- featurePreReconcile, featureReconcile))
- {
- //Console.WriteLine(
- // " Shape attribute has changed on both versions...");
- // Geometries are in conflict ... merge geometries.
- try
- {
- IConstructMerge constructMerge = new
- GeometryEnvironmentClass();
- IGeometry newGeometry =
- constructMerge.MergeGeometries
- (featureCommonAncestor.ShapeCopy,
- featureReconcile.ShapeCopy,
- featurePreReconcile.ShapeCopy);
- // Setting new geometry as a merge between the two versions.
- IFeature feature = featureClass.GetFeature(sOID);
- feature.Shape = newGeometry;
- feature.Store();
- //updateUpdates.RemoveList(1, ref oid);
- //conflictsRemoved = true;
- }
- catch (System.Runtime.InteropServices.COMException comExc)
- {
- // Check if the error is from overlapping edits.
- if (comExc.ErrorCode == (int)
- fdoError.FDO_E_WORKSPACE_EXTENSION_DATASET_CREATE_FAILED || comExc.ErrorCode == (int)fdoError.FDO_E_WORKSPACE_EXTENSION_DATASET_DELETE_FAILED)
- {
- // Edited areas overlap.
- LSCommonHelper.MessageBoxHelper.ShowMessageBox(
- "Error from overlapping edits on feature {0}"+
- " Can't merge overlapping edits to same feature.");
- }
- else
- {
- // Unexpected COM exception, throw this to the exception handler.
- throw comExc;
- }
- }
- }
- }
- }
- }
- }
- }
相关代码下载地址,下载完毕后,请使用kuaiya解压即可,WINRAR不行
ArcGIS Engine开发的ArcGIS 版本管理的功能的更多相关文章
- ArcGIS Engine开发鹰眼图的功能(代码优化篇)
在上一篇,ArcGIS Engine开发鹰眼图的功能(基础篇) 上一篇的实现效果图如下, 如果仔细观察,会发现一个问题,即在“鹰眼”的区域,只要在红色线框内的注记会被覆盖. 如果红色框包括整张图的话, ...
- ArcGIS Engine开发鹰眼图的功能(基础篇)
鹰眼是用于调节全视域范围内主地图显示范围情况的副地图.它体现了地图整体与详细局部的关系. 用户可以通过鼠标单击或者画框等动作实现鹰眼与主地图的交互情况. 鹰眼功能的原理是通过主地图窗口的地图控件和鹰眼 ...
- ArcGIS Engine开发之地图基本操作(4)
ArcGIS Engine开发中数据库的加载 1.加载个人地理数据库数据 个人地理数据库(Personal Geodatabase)使用Miscrosoft Access文件(*.mdb)进行空间数据 ...
- ArcGIS Engine开发前基础知识(3)
对象模型图 一.对象模型图中的类与接口 ArcGIS Engine 提供大量的对象,这些对象之间存在各种各样的关系,如继承.组合.关联等.对象模型图(Object model diagram,ODM) ...
- ArcGIS Engine开发前基础知识(2)
ArcGIS基本控件简介 ArcGIS Engine控件是一组可视化的开发组件,每个ArcGIS Engine控件都是一个COM组件.这些组件包括MapControl,PageLayoutContro ...
- C#,ArcGIS Engine开发入门教程
C#,ArcGIS Engine开发入门教程 转自:http://blog.csdn.net/yanleigis/article/details/2233674 目录(?)[+] 五实现 一 加载A ...
- ArcGIS Engine开发基础总结(一)
标准Engine功能 地图浏览 地图制作 数据查询 数据分析 及 所有的开发控件 —MapControl, PageLayout, Toolbar, TOC, ArcReader 对所有矢量和栅 ...
- ArcGIS Engine开发前基础知识(4)
ArcGIS不同开发方式的比较 关于GIS应用软件的开发,通常有三种方式:C/S架构.网络GIS和移动GIS.ArcGIS平台提供了对三种开发方式的支持,对于采用从C/S架构的大多数开发者来讲,首先想 ...
- ArcGIS Engine开发前基础知识(1)
ArcGIS二次开发是当前gis领域的一项重要必不可少的技能.下面介绍它的基本功能 一.ArcGIS Engine功能 在使用之前首先安装和部署arcgis sdk,(在这里不在赘述相关知识)可以实现 ...
随机推荐
- python 代码片段14
#coding=utf-8 #enumerate是一个内置函数 data=(123,'abc',3.14) for i,value in enumerate(data): print i,value
- BZOJ4060 : [Cerc2012]Word equations
首先通过hash建树 设f[i][j]表示第i个特殊符号从P的第j位开始匹配能到达哪里 记忆化搜索,对于底层贪心匹配. #include<cstdio> #include<cstri ...
- BZOJ3745 : [Coci2014]Norma
考虑枚举右端点,用线段树维护[i,nowr]的答案. 当右端点向右延伸时,需要知道它前面第一个比它大/小的数的位置,这里面的最值将发生改变,这个使用单调队列求出,然后将所有的l都加1. 注意常数优化. ...
- Android 与 IIS服务器身份验证
1)基础验证: /** * 从服务器取图片 * * @param url * @return */ public void getHttpBitmap(final String url) { new ...
- HDU 4649 Professor Tian(DP)
题目链接 暴力水过的,比赛的时候T了两次,优化一下初始化,终于水过了. #include <cstdio> #include <cstring> #include <st ...
- httpclient爬取性感美图
依赖httpclient4.2,Jsop SemeiziCrawler.java package kidbei.learn.crawler; import java.io.File; import j ...
- iOS下json的解析 NSJSONSerialization
- (IBAction)JOSNButtonPressed:(id)sender { NSString *str=[@"http://douban.fm/j/mine/playlist? ...
- Shtml妙用
shtml用的是SSI指令, SSI指令虽然不多 但是功能相对而言还是很强大的, 在PHP禁止了命令执行函数和开了安全模式的时候可以试试看 也可以在服务器允许上传shtml后缀脚本的时候试试 PS:只 ...
- Struts2 实战(一)
环境: Ubuntu 14.04 LTS 64位 开发工具的准备 我选择 Eclipse, 而没有选择MyEclipse, 一是因为免费,不想去弄破解,二是不想太傻瓜化的东西(注:本人并没有用过MyE ...
- Html - a标签如何包裹Div
a标签如何包裹Div? 其实应该将思路转变为将a标签作为一个遮罩来覆盖div. 做法是将a标签放置在该div下,通过将div进行相对定位[position:relative] 将a标签进行绝对定位[p ...