Browse Source

简单调整

zzj 6 years ago
parent
commit
5338fcede3
4 changed files with 32 additions and 15 deletions
  1. 4 4
      Makefile.am
  2. 1 1
      line.h
  3. 9 5
      net-service.cpp
  4. 18 5
      point.h

+ 4 - 4
Makefile.am

@@ -1,10 +1,10 @@
 bin_PROGRAMS=yals 
 noinst_PROGRAMS=client async test
 
-AM_SOURCES= ant.cpp ant.h base64.cpp base64.h card.cpp card.h clock.h \
-io_buf.h line.h log.h message.cpp message.h point.cpp \
-point.h tdoa_sync.cpp tdoa_sync.h web-client.cpp web-client.h worker.cpp worker.h zio.h \
-zloop.h znet.cpp znet.h zstream.h net-service.h net-service.cpp loc_tool.h loc_tool.cpp
+AM_SOURCES=ant.cpp ant.h card.cpp card.h clock.h \
+crc.cpp crc.h io_buf.h line.h loc_tool.cpp loc_tool.h message.cpp \
+message_file.h message.h net-service.cpp net-service.h point.cpp point.h tdoa_sync.cpp tdoa_sync.h \
+worker.cpp worker.h zio.h zloop.h znet.cpp znet.h zstream.h
 
 AM_CPPFLAGS=-Wall -pthread -m64 -std=c++11 -fPIC -I${prefix}/include
 AM_LDFLAGS= -Wall -pthread -m64 -std=c++11 -fPIC -L${prefix}/lib 

+ 1 - 1
line.h

@@ -120,6 +120,7 @@ struct line
 		return fabs(a*x+b*y+c)<e;
 	}
 };
+
 struct line_v:line//线段
 {
 	std::array<point,2> v;
@@ -221,4 +222,3 @@ struct line_v:line//线段
 };
 #endif
 
-

+ 9 - 5
net-service.cpp

@@ -28,12 +28,14 @@ net_service::~net_service()
 
 void net_service::on_message(std::shared_ptr<client> clt,const char*data,size_t len)
 {
-	std::vector<char> v(data,data+len);
-	clt->send(std::move(v));
+	//std::vector<char> v(data,data+len);
+	//clt->send(std::move(v));
 
-	//		log_info("recv a message ,len=%d",len);
-	//		logn_bin(1,"50ms .test",data,len);
-	return;
+	//log_info("recv a message ,len=%d",len);
+	//logn_bin(1,"50ms .test",data,len);
+	//return;
+
+	logn_bin(1,"",data,len);//输出二进制日志
 
 	zistream is(data,len-2);
 	uint16_t cmd;
@@ -88,3 +90,5 @@ void net_service::on_message(std::shared_ptr<client> clt,const char*data,size_t
 			break;
 	}
 }
+
+

+ 18 - 5
point.h

@@ -5,9 +5,18 @@
 struct point
 {
 	point();
-	point(double x_,double y_)
+	point(double x_,double y_,double z_=0)
 		:x(x_)
 		,y(y_)
+		,z(z_)
+	{
+	
+	}
+
+	point(const point&pt)
+		:x(pt.x)
+		,y(pt.y)
+		,z(pt.z)
 	{
 	
 	}
@@ -37,7 +46,11 @@ struct point
 		if(c!=0) 
 			return c<0;
 
-		return y-p.y<0;
+		c=y-p.y;
+		if(c!=0) 
+			return c<0;
+
+		return z-p.z<0;
 	}
 
 	static bool eq(double l,double r,double deta)
@@ -47,12 +60,12 @@ struct point
 
 	bool empty()const
 	{
-		return x==0 && y==0;
+		return x==0 && y==0 && z==0;
 	}
 
 	bool operator==(const point&r)const
 	{
-		return x==r.x && y==r.y;
+		return x==r.x && y==r.y && z==r.z;
 	}
 
 	double dist_direct(const point&o)const
@@ -118,7 +131,7 @@ struct point
 	}
 
 public:
-	double x,y;
+	double x,y,z;
 };
 #endif