Android 旋转盘导航栏
1.直接上源码:
package com.you.arc;import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;public class ArcFramelayout extends FrameLayout {private final String TAG = "ArcFramelayout";private Paint redPaint = new Paint();private Paint bluePaint = new Paint();private Paint greenPaint = new Paint();private boolean isLayout;private float[] srcDegreesArr = null;private float[] moveDegreesArr = null;private float defaultDegrees;private float minGapDg = 360f;private final int DEFAULT_INDEX = 2;private OnArcItemListener onItemSelectedListener;public void setOnArcItemListener(OnArcItemListener onItemSelectedListener) {this.onItemSelectedListener = onItemSelectedListener;}public interface OnArcItemListener {void onItemSelected(int pos);void onItemClick(int viewId);}public ArcFramelayout(Context context) {this(context, null);}public ArcFramelayout(Context context, @Nullable AttributeSet attrs) {this(context, attrs, 0);}public ArcFramelayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);redPaint.setColor(Color.RED);redPaint.setStyle(Paint.Style.FILL_AND_STROKE);redPaint.setAntiAlias(true);bluePaint.setColor(Color.BLUE);bluePaint.setStyle(Paint.Style.FILL_AND_STROKE);bluePaint.setAntiAlias(true);greenPaint.setColor(Color.GREEN);greenPaint.setStyle(Paint.Style.FILL_AND_STROKE);greenPaint.setAntiAlias(true);greenPaint.setStrokeWidth(9);}private float mDx, mDy, sweepAngle;//按下坐标值private int action;@Overridepublic boolean onTouchEvent(MotionEvent event) {this.action = event.getAction();switch (event.getAction()) {case MotionEvent.ACTION_DOWN:mDx = event.getX();mDy = event.getY();Log.i(TAG, "down=mDx=" + mDx + ",mDy=" + mDy);break;case MotionEvent.ACTION_MOVE:float mx = event.getX();float my = event.getY();float disW = mx - mDx;//x轴滑动距离float disH = my - mDy;//y轴滑动距离if (!isLayout) {if (Math.abs(disW) > Math.abs(disH)) {//滑动轴判断(这个条件可根据实际需求判断)if (disW > 0) {//往右滑touchHandle(mDy < oval.centerY());Log.i(TAG, "move=往右滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);} else {//往左滑touchHandle(mDy > oval.centerY());Log.i(TAG, "move=往左滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);}} else {if (disH > 0) {//往下滑touchHandle(mDx > oval.centerX());Log.i(TAG, "move=往下滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);} else {//往上滑touchHandle(mDx < oval.centerX());Log.i(TAG, "move=往上滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);}}}mDx = mx;//替换x轴坐标值mDy = my;//替换y轴坐标值break;case MotionEvent.ACTION_UP:
// updateSelected();break;}return true;}private void updateSelected() {isLayout = true;float srcDg = srcDegreesArr[DEFAULT_INDEX];float moveDg = moveDegreesArr[selectIndex];float diffDg = moveDg > srcDg ? moveDg - srcDg : srcDg - moveDg;Log.i(TAG, "updateSelected-srcDg=" + srcDg + ",moveDg=" + moveDg + ",diffDg=" + diffDg);for (int i = 0; i < moveDegreesArr.length; i++) {
// moveDegreesArr[i] = moveDg > srcDg ? moveDegreesArr[i] - diffDg : moveDegreesArr[i] + diffDg;}requestLayout();}private void touchHandle(boolean isAdd) {isLayout=true;rotate(isAdd);}private void touchHandle(boolean isAdd, float dis, boolean isRunAnim) {isLayout = true;if (!isRunAnim) {dis = Math.min(Math.abs(dis), 1.6f);}int childCount = getChildCount();for (int i = 0; i < childCount; i++) {float newDegrees = isAdd ? moveDegreesArr[i] + dis : moveDegreesArr[i] - dis;newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;Log.i(TAG, "touchHandle-i=" + i + ",newDegrees=" + newDegrees);moveDegreesArr[i] = newDegrees;}/*int childCount = getChildCount();for (int i = 0; i < childCount; i++) {int nextIndex = i == childCount - 1 ? 0 : i + 1;float sdg = moveDegreesArr[nextIndex];float mdg = moveDegreesArr[i];float cwDiff = (sdg - mdg);cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;float ccwDiff = (mdg - sdg);ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;float diff = Math.min(cwDiff, ccwDiff);dis = (diff / 10f);float newDegrees = cwDiff < ccwDiff ? (mdg + dis) : (mdg - dis);newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;moveDegreesArr[i] = newDegrees;Log.i(TAG, "touchHandle-i=" + i + ",cwDiff=" + cwDiff + ",ccwDiff="+ ccwDiff + ",dis=" + dis + ",degrees=" + mdg + ",newDegrees=" + newDegrees);}*/sweepAngle = isAdd ? sweepAngle + dis : sweepAngle - dis;sweepAngle = sweepAngle % 360f;Log.i(TAG, "touchHandle-isAdd=" + isAdd + ",dis=" + dis + ",sweepAngle=" + sweepAngle);requestLayout();}private float[] animDegreesArr = null;private void runAnim(boolean isAdd) {isLayout = true;int childCount = getChildCount();if (animDegreesArr == null) {animDegreesArr = new float[childCount];for (int i = 0; i < childCount; i++) {animDegreesArr[i] = moveDegreesArr[i];}}for (int i = 0; i < childCount; i++) {int nextIndex = isAdd ? (i == childCount - 1 ? 0 : i + 1) : (i == 0 ? childCount - 1 : i - 1);float sdg = animDegreesArr[nextIndex];float mdg = animDegreesArr[i];float cwDiff = (sdg - mdg);cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;float ccwDiff = (mdg - sdg);ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;float diff = isAdd ? cwDiff : ccwDiff;float dis = (diff / 10f);float newDegrees = isAdd ? (moveDegreesArr[i] + dis) : (moveDegreesArr[i] - dis);newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;moveDegreesArr[i] = runCount==10 ? sdg : newDegrees;Log.i(TAG, "runAnim-i=" + i + ",cwDiff=" + cwDiff + ",ccwDiff=" + ccwDiff + ",dis=" + dis +",sdg=" + sdg + ",mdg=" + mdg + ",newDegrees=" + newDegrees);}requestLayout();}private boolean isCW = true;public void rotate(boolean isCW) {this.isCW=isCW;post(runnable);}private int runCount = 0;private Runnable runnable = new Runnable() {float mdg = -1;@Overridepublic void run() {isLayout = true;runCount++;if (runCount <= 10) {/*float sdg = srcDegreesArr[DEFAULT_INDEX];if (mdg == -1) {mdg = moveDegreesArr[clickIndex];}float cwDiff = (sdg - mdg);cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;float ccwDiff = mdg - sdg;ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;float diff = Math.min(cwDiff, ccwDiff);float rDg = (diff / 10f);touchHandle(cwDiff < ccwDiff, rDg, true);Log.i(TAG, "runnable-runCount=" + runCount + ",diff=" + diff + ",rDg=" + rDg + ",clickIndex=" + clickIndex + ",mdg=" + mdg + ",sdg=" + sdg);runAnim(cwDiff < ccwDiff);*/runAnim(isCW);Log.i(TAG, "runnable-runCount=" + runCount);postDelayed(this, 40);} else {animDegreesArr = null;runCount = 0;mdg = -1;isLayout = false;}}};private boolean checkDiret(int clickIndex) {float sdg = srcDegreesArr[DEFAULT_INDEX];float mdg = moveDegreesArr[clickIndex];float cwDiff = (sdg - mdg);cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;float ccwDiff = mdg - sdg;ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;return cwDiff < ccwDiff;}private int clickIndex;@Overrideprotected void onFinishInflate() {super.onFinishInflate();int childCount = getChildCount();srcDegreesArr = new float[childCount];moveDegreesArr = new float[childCount];for (int i = 0; i < childCount; i++) {View childView = getChildAt(i);/* childView.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View view) {if (view.isSelected()) {if (onItemSelectedListener != null) {onItemSelectedListener.onItemClick(view.getId());}} else {if (!isLayout) {isLayout = true;for (int j = 0; j < childCount; j++) {float d = Float.valueOf(childView.getTag().toString());if (d == srcDegreesArr[j]) {clickIndex = j;break;}}isCW=checkDiret(clickIndex);post(runnable);}}}});*/float degrees = Float.valueOf(childView.getTag().toString());int nextIndex = i == childCount - 1 ? 0 : i + 1;float nextDg = Float.valueOf(getChildAt(nextIndex).getTag().toString());float gapDg = (nextDg - degrees) < 0 ? (nextDg - degrees) + 360 : (nextDg - degrees);minGapDg = Math.min(gapDg, minGapDg);srcDegreesArr[i] = degrees;moveDegreesArr[i] = degrees;Log.i(TAG, "onFinishInflate-childCount=" + childCount + ",i=" + i + ",degrees=" + degrees + ",minGapDg=" + minGapDg);}}private boolean isContainDegrees(float moveDegrees) {float centerDg = srcDegreesArr[DEFAULT_INDEX];float preDg = srcDegreesArr[DEFAULT_INDEX == 0 ? srcDegreesArr.length - 1 : DEFAULT_INDEX - 1];float nextDg = srcDegreesArr[DEFAULT_INDEX == srcDegreesArr.length - 1 ? 0 : DEFAULT_INDEX + 1];float preHalfDg = (centerDg - preDg) < 0 ? 360 - (centerDg - preDg) : (centerDg - preDg);float nextHalfDg = (nextDg - centerDg) < 0 ? 360 - (nextDg - centerDg) : (nextDg - centerDg);float preCpDg = (centerDg - (preHalfDg * 0.5f)) < 0 ? 360f - (centerDg - (preHalfDg * 0.5f)) : (centerDg - (preHalfDg * 0.5f));float nextCpDg = (centerDg + (nextHalfDg * 0.5f)) > 360f ? (centerDg + nextHalfDg * 0.5f) - 360f : (centerDg + (nextHalfDg * 0.5f));Log.i(TAG, "isContainDegrees-moveDegrees=" + moveDegrees + ",centerDg=" + centerDg + ",preDg=" + preDg + ",nextDg=" + nextDg + ",preHalfDg=" + preHalfDg + ",nextHalfDg=" + nextHalfDg + ",preCpDg=" + preCpDg + ",nextCpDg=" + nextCpDg);return (moveDegrees >= preCpDg && moveDegrees < nextCpDg);
// return (moveDegrees >= centerDg && moveDegrees <= nextDg);}private int vWidth;private int vHeight;private int selectIndex = DEFAULT_INDEX;@Overrideprotected void onLayout(boolean changed, int l, int t, int r, int b) {isLayout = true;vWidth = getMeasuredWidth();vHeight = getMeasuredHeight();int childCount = getChildCount();Log.i(TAG, "onLayout-changed=" + changed + ",l=" + l + ",t=" + t + ",r=" + r + ",b=" + b + ",vWidth=" + vWidth + ",vHeight=" + vHeight + ",childCount=" + childCount + ",sweepAngle=" + sweepAngle);for (int i = 0; i < childCount; i++) {View childView = getChildAt(i);float degrees = moveDegreesArr[i];if (isContainDegrees(degrees)) {selectIndex = i;}Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -degrees);int cvW = childView.getMeasuredWidth();int cvH = childView.getMeasuredHeight();Log.i(TAG, "onLayout-i=" + i + ",px=" + endPoint.x + ",py=" + endPoint.y + ",cvW=" + cvW + ",cvH=" + cvH + ",degrees=" + degrees);childView.layout((int) (endPoint.x - cvW * 0.5f), (int) (endPoint.y - cvH * 0.5f), (int) (endPoint.x + cvW * 0.5f), (int) (endPoint.y + cvH * 0.5f));}if (onItemSelectedListener != null) {onItemSelectedListener.onItemSelected(selectIndex);}isLayout = false;}private RectF oval = new RectF(-290, 65, 960, 525);@Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);Log.i(TAG, "onDraw");Paint p = new Paint();p.setStrokeWidth(10);p.setColor(Color.RED);Paint p0 = new Paint();p0.setStrokeWidth(5);p0.setColor(Color.GREEN);Paint p1 = new Paint();p1.setColor(Color.parseColor("#808C8C8C"));// canvas.drawArc(oval.left, oval.top, oval.right, oval.bottom, 0, 360, true, p1);
// canvas.drawLine(oval.left, oval.top + oval.height() / 2, oval.right, oval.top + oval.height() / 2, p);
// canvas.drawLine(oval.left + oval.width() / 2f, oval.top, oval.left + oval.width() / 2f, oval.bottom, p);int childCount = getChildCount();for (int i = 0; i < childCount; i++) {View childView = getChildAt(i);float degrees = Float.valueOf(childView.getTag().toString());Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -degrees);canvas.drawPoint(endPoint.x, endPoint.y, p0);}Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -19);canvas.drawPoint(endPoint.x, endPoint.y, p);}private Point getEndPoint(float x, float y, float width, float height, float startAngle, float extentAngle) {double var1 = Math.toRadians(-startAngle - extentAngle);double var3 = x + (Math.cos(var1) * 0.5 + 0.5) * width;double var5 = y + (Math.sin(var1) * 0.5 + 0.5) * height;return new Point((int) var3, (int) var5);}}
2.MainActivity
package com.you.arc;import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;//import java.awt.geom.Arc2D;//这个类里面有圆周运动计算公式public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);ArcFramelayout arcFramelayout = findViewById(R.id.arc_framelayout);arcFramelayout.setOnArcItemListener(new ArcFramelayout.OnArcItemListener() {@Overridepublic void onItemSelected(int pos) {for (int i = 0; i < arcFramelayout.getChildCount(); i++) {if (i == pos) {ViewGroup parent = ((ViewGroup) arcFramelayout.getChildAt(i));parent.setSelected(true);for (int j = 0; j < parent.getChildCount(); j++) {parent.getChildAt(j).setSelected(true);}
// ((ViewGroup) arcFramelayout.getChildAt(i)).getChildAt(0).setBackgroundColor(Color.parseColor("#80FF0000"));} else {ViewGroup parent = ((ViewGroup) arcFramelayout.getChildAt(i));parent.setSelected(false);for (int j = 0; j < parent.getChildCount(); j++) {parent.getChildAt(j).setSelected(false);}
// ((ViewGroup) arcFramelayout.getChildAt(i)).getChildAt(0).setBackground(null);}}}@Overridepublic void onItemClick(int viewId) {Toast.makeText(MainActivity.this, "tag=" + findViewById(viewId).getTag(), Toast.LENGTH_SHORT).show();switch (viewId) {case R.id.ll_phone:break;case R.id.ll_flag:break;case R.id.ll_connect:break;case R.id.ll_setting:break;case R.id.ll_audi:break;case R.id.ll_dashboard:break;case R.id.ll_earth:break;case R.id.ll_cd:break;}}});findViewById(R.id.iv_small_arrow).setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {arcFramelayout.rotate(false);}});findViewById(R.id.iv_big_arrow).setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {arcFramelayout.rotate(true);}});}
}
3.布局
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@android:color/black"tools:context=".MainActivity"><com.you.arc.ArcViewandroid:layout_width="1200px"android:layout_height="550px"android:visibility="gone"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" /><FrameLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><ImageViewandroid:id="@+id/iv_small_arrow"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/ic_small_arrow"android:layout_marginTop="140px"/><ImageViewandroid:id="@+id/iv_big_arrow"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/ic_big_arrow"android:layout_gravity="bottom"android:layout_marginBottom="40px"/><com.you.arc.ArcFramelayoutandroid:id="@+id/arc_framelayout"android:layout_width="1400px"android:layout_height="match_parent"android:layout_marginStart="0px"android:layout_marginTop="76px"android:background="@android:color/transparent"><LinearLayoutandroid:id="@+id/ll_phone"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="6"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/green_text_selector"android:text="电话"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_flag"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="36"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/blue_text_selector"android:text="旗帜"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_connect"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="62"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:background="@android:color/transparent"android:src="@drawable/phone_selector"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/green_text_selector"android:text="蓝牙连接"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_setting"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="90"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:background="@drawable/blue_text_selector"android:maxWidth="330px"android:text="设置"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_audi"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="262"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/red_text_selector"android:text="手机"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_dashboard"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="286"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/red_text_selector"android:text="时钟"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_earth"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="311"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/green_text_selector"android:text="地球"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout><LinearLayoutandroid:id="@+id/ll_cd"android:layout_width="wrap_content"android:layout_height="wrap_content"android:tag="337"><ImageViewandroid:layout_width="150px"android:layout_height="180px"android:src="@drawable/phone_selector"android:background="@android:color/transparent"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:maxWidth="330px"android:background="@drawable/yellow_text_selector"android:text="媒体"android:textColor="@android:color/white"android:textSize="45px"android:textStyle="bold" /></LinearLayout></com.you.arc.ArcFramelayout></FrameLayout>
</FrameLayout>
手势滑动目前尚未完善,可以根据实际需求完善
demo下载地址:https://download.csdn.net/download/qq_29364417/90203270
相关文章:
Android 旋转盘导航栏
1.直接上源码: package com.you.arc;import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.graphics.RectF; import android.support…...
matlab-数字滤波器设计与实战
文章目录 数字滤波器设计FIR 滤波器设计IIR 滤波器设计巴特沃斯滤波器切比雪夫 I 型滤波器切比雪夫II型椭圆滤波器线性相位与非线性相位零相位响应数字滤波器实战数字滤波器产生延迟的主要原因补偿滤波引入的延迟补偿常量滤波器延迟补偿与频率有关的延迟从信号中除去不需要的频…...
虚拟机中的时统卡功能和性能调优
【写在前面】 飞腾开发者平台是基于飞腾自身强大的技术基础和开放能力,聚合行业内优秀资源而打造的。该平台覆盖了操作系统、算法、数据库、安全、平台工具、虚拟化、存储、网络、固件等多个前沿技术领域,包含了应用使能套件、软件仓库、软件支持、软件适…...
[算法] [leetcode-20] 有效的括号
20 有效的括号 给定一个只包括 ‘(’,‘)’,‘{’,‘}’,‘[’,‘]’ 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合…...
TDengine 如何进行高效数据建模
1.背景 数据建模对于数据库建立后整体高效运行非常关键,不同建模方式,可能会产生相差几倍的性能差别 2. 建库 建模在建库阶段应考虑几下几点: 建多少库 根据业务情况确定建库个数,TDengine 不支持跨库查询,如果业…...
2024.12.30(多点通信)
作业: 1、将广播发送和接收端实现一遍,完成一个发送端发送信息,对应多个接收端接收信息实验。 发送端 #include <myhead.h>#define PORT 8888 #define IP "192.168.124.255"int main(int argc, const char *argv[]) {//1、…...
前端路由layout布局处理以及菜单交互(三)
上篇介绍了前端项目部署以及基本依赖的应用,这次主要对于路由以及布局进行模块化处理 一、 创建layout模块 1、新建src/layout/index.vue <template><el-container class"common-layout"><!-- <el-aside class"aside">&l…...
Zynq PS端外设之GPIO
1. GPIO(通用输入/输出) GPIO外设有4个Bank,Bank0/1通过MIO连接到PS的引脚上;Bank2/3通过EMIO连接到PL的引脚上。 注意:Bank1的电平要改成LVCOMS 1.8 GPIO寄存器 寄存器: DATA_RO: 读取GPIO的输…...
Java 操作 PDF:从零开始创建功能丰富的PDF文档
Java 操作 PDF:从零开始创建功能丰富的PDF文档 引言环境准备依赖引入 创建PDF文档一键生成空白PDF添加表单字段(选项)添加电子签名添加公章图像 结论 引言 随着数字化办公的普及,PDF格式因其跨平台兼容性和安全性而被广泛应用于各…...
12.30-1-5学习周报
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 文章链接摘要Abstract一、方法介绍1.HAT-CIR2.Horde3.DWGRNet 二、实验总结 文章链接 https://arxiv.org/pdf/2405.04101 摘要 本博客介绍了论文《Continual lea…...
H3C Tftp 备份与恢复配置文件
pc 运行 tftp 软件与路由器相连。打开 tftp。 在交换机用户试图下,dir /all 命令查看设备的配置文件。 备份命令:将配置文件备份到地址为 10.10.10.2 的 tftp 服务器 <H3C>backup startup-configuration to 10.10.10.2 恢复命令:恢复配…...
【Matlab算法】基于改进人工势场法的移动机器人路径规划研究(附MATLAB完整代码)
基于改进人工势场法的移动机器人路径规划研究 结果图摘要1. 引言2. 方法说明2.1 基本原理2.2 改进策略3. 核心函数解释3.1 改进的斥力计算函数3.2 路径规划主函数4. 实验设计4.1 实验环境设置4.2 关键参数选择5. 结果分析5.1 实验结果5.2 性能分析附录:完整代码参考文献结果图…...
基于Springboot校园失物招领系统【附源码】
基于Springboot校园失物招领系统 效果如下: 系统登陆页面 物品页面 系统首页面 失物招领管理页面 失物认领页面 宣传视频页面 物品挂失留言管理页面 宣传视频类型管理页面 研究背景 在校园环境中,失物招领是一个常见的问题。传统的失物招领方式主要依…...
Vue 自定义指令
首先,我们知道vue中有很多自带指令,v-bind、v-on、v-model等。但在业务开发中,我们常见一些自定义指令如:v-copy、v-longpress等。那么如何定义自己所需的指令呢? 接下来我们分别从指令注册、指令的钩子函数、指令的参…...
JAVA-制作小游戏期末实训
源码 import game.frame.Frame;public class App {public static void main(String[] args) {System.out.println("starting......");new Frame();} } package game.controller;import game.model.Enemy;public class EnemyController implements Runnable{private…...
【Vue教程】使用Vite快速搭建前端工程化项目 | Vue3 | Vite | Node.js
🙋大家好!我是毛毛张! 🌈个人首页: 神马都会亿点点的毛毛张 🚩今天毛毛张分享的是关于如何快速🏃♂️搭建一个前端工程化的项目的环境搭建以及流程🌠 文章目录 1.前端工程化环境搭建&#…...
4.CSS文本属性
4.1文本颜色 div { color:red; } 属性值预定义的颜色值red、green、blue、pink十六进制#FF0000,#FF6600,#29D794RGB代码rgb(255,0,0)或rgb(100%,0%,0%) 4.2对齐文本 text-align 属性用于设置元素内文本内容的水平对齐方式。 div{ text-align:center; } 属性值解释left左对齐ri…...
【工具整理】WIN换MAC机器使用工具整理
最近公司电脑升级,研发同学统一更换了 Mac Book Pro 笔记版电脑,整理一下安装了那些软件以及出处,分享记录下~ 知识库工具 1、语雀 网址:语雀,为每一个人提供优秀的文档和知识库工具 语雀 个人花园&…...
Elasticsearch向量检索需要的数据集以及768维向量生成
Elasticsearch8.17.0在mac上的安装 Kibana8.17.0在mac上的安装 Elasticsearch检索方案之一:使用fromsize实现分页 快速掌握Elasticsearch检索之二:滚动查询(scrool)获取全量数据(golang) Elasticsearch检索之三:官方推荐方案search_after…...
《小型支付商城系统》项目(一)DDD架构入门
目录 1.DDD架构 1.1充血模型 1.2领域模型 1.2.1实体 1.2.2值对象 1.2.3聚合 1.2.4领域服务 1.2.5工厂 1.2.6仓储(Repository) 2.DDD建模 3.DDD工程模型 项目介绍:知识星球 | 深度连接铁杆粉丝,运营高品质社群ÿ…...
web课程设计--酷鲨商城-springboot和vue
文章目录 页面截图技术分析数据库代码地址 页面截图 登陆页面: 分类列表 添加分类 轮播图列表 添加轮播图 商品列表 添加商品信息 技术分析 前端使用 html页面的 vue.js(vue2)和element-ui绘制前端界面 后台使用Springbootmybatis来实现crud。还有一…...
解决virtualbox克隆ubuntu虚拟机之后IP重复的问题
找遍了国内论坛,没一个能解决该问题的,所以我自己写个文章吧,真讨厌那些只会搬运的,污染国内论坛环境,搜一个问题,千篇一律。 问题 操作系统版本为"Ubuntu 24.04 LTS" lennytest1:~$ cat /etc…...
活动预告 |【Part1】Microsoft Azure 在线技术公开课:使用 Azure DevOps 和 GitHub 加速开发
课程介绍 通过 Microsoft Learn 免费参加 Microsoft Azure 在线技术公开课,掌握创造新机遇所需的技能,加快对 Microsoft Cloud 技术的了解。参加我们举办的“使用 Azure DevOps 和 GitHub 加速开发”活动,了解迁移到 DevOps 所需的合适工具和…...
SpiderFlow平台v0.5.0之数据库连接
一、寻找lib目录安装方式 在 SpiderFlow 平台中,连接数据库时需要指定数据库的 DriverClassName,并确保正确配置数据库驱动。通常,驱动文件(JAR 文件)需要放置在指定的文件夹中,以便 SpiderFlow 可以找到并…...
springboot集成阿里云短信服务
springboot集成阿里云短信服务 一.阿里云账号准备 流程:注册阿里云账号>短信服务>新增资质>新建签名>新建模版>申请秘钥>用代码测试 1.注册阿里云账号 2、登录成功后, ① 在首页搜索短信服务 ② 打开第一个搜索结果 ③ 免费开通 ④ 可以根据…...
Redis 实战篇 ——《黑马点评》(上)
《引言》 在进行了前面关于 Redis 基础篇及其客户端的学习之后,开始着手进行实战篇的学习。因内容很多,所以将会分为【 上 中 下 】三篇记录学习的内容与在学习的过程中解决问题的方法。Redis 实战篇的内容我写的很详细,为了能写的更好也付出…...
Redis的生态系统和社区支持
Redis的生态系统和社区支持 1. Redis 生态系统 1.1 Redis核心 Redis 是一个高性能的内存存储系统,支持丰富的数据结构(如字符串、列表、集合、哈希和有序集合)。它的核心提供了: 高性能数据存储:单线程模型支持每秒数百万级别的操作。多种数据结构:适用于多样化场景,如…...
基于C语言从0开始手撸MQTT协议代码连接标准的MQTT服务器,完成数据上传和命令下发响应(华为云IOT服务器)
文章目录 一、前言二、搭建开发环境三、网络编程基础概念科普3.1 什么是网络编程3.2 TCP 和 UDP协议介绍3.3 TCP通信的实现过程 四、Windows下的网络编程相关API介绍4.1 常用的函数介绍4.2 函数参数介绍4.3 编写代码体验网络编程 五、访问华为云IOT服务器创建一个产品和设备5.2…...
什么是 GPT?Transformer 工作原理的动画展示
大家读完觉得有意义记得关注和点赞!!! 目录 1 图解 “Generative Pre-trained Transformer”(GPT) 1.1 Generative:生成式 1.1.1 可视化 1.1.2 生成式 vs. 判别式(译注) 1.2 Pr…...
IDEA 编辑器自动识别 Dockerfile 类型高亮和语法提示
在 IDEA 中,如果项目里面的只有一个 Dockerfile文件时,那么此时使用打开这个文件都是 ok 的,支持语法高亮和关键词提示。 如果我们有多个 Dockerfile 时, 比如 A_Dockerfile , B_Dockerfile , C_Dockerfile, 这个时候你会发现 IDE…...
AI知识库与用户行为分析:优化用户体验的深度洞察
在当今数字化时代,用户体验(UX)已成为衡量产品成功与否的关键指标之一。AI知识库作为智能客服系统的重要组成部分,不仅为用户提供快速、准确的信息检索服务,还通过用户行为分析,为产品优化提供了深度洞察。…...
什么是Redis哨兵机制?
大家好,我是锋哥。今天分享关于【什么是Redis哨兵机制?】面试题。希望对大家有帮助; 什么是Redis哨兵机制? 1000道 互联网大厂Java工程师 精选面试题-Java资源分享网 Redis 哨兵(Sentinel)机制是 Redis 提…...
JavaScript中如何创建对象
在JavaScript中,创建对象有多种方法。以下是几种常见的方式: 1. 对象字面量 这是最直接和常用的创建对象的方法。使用花括号 {} 包围一组键值对来定义一个对象。 let person {name: "John",age: 30,greet: function() {console.log("…...
2025:OpenAI的“七十二变”?
朋友们,准备好迎接AI的狂欢了吗?🚀 是不是跟我一样,每天醒来的第一件事就是看看AI领域又有什么新动向? 尤其是那个名字如雷贯耳的 OpenAI,简直就是AI界的弄潮儿,一举一动都牵动着我们这些“AI发…...
Mysql(MGR)和ProxySQL搭建部署-Kubernetes版本
一、Mysql(MGR) 1.1 statefulSet.yaml apiVersion: apps/v1 kind: StatefulSet metadata:labels:app: mysqlname: mysqlnamespace: yihuazt spec:replicas: 3serviceName: mysql-headlessselector:matchLabels:app: mysqltemplate:metadata:labels:app: mysqlspec:affinity:p…...
uni-app 多平台分享实现指南
uni-app 多平台分享实现指南 在移动应用开发中,分享功能是一个非常常见的需求,尤其是在社交媒体、营销活动等场景中。使用 uni-app 进行多平台开发时,可以通过一套代码实现跨平台的分享功能,涵盖微信小程序、H5、App 等多个平台。…...
Windows系统下载、部署Node.js与npm环境的方法
本文介绍在Windows电脑中,下载、安装并配置Node.js环境与npm包管理工具的方法。 Node.js是一个基于Chrome V8引擎的JavaScript运行时环境,其允许开发者使用JavaScript编写命令行工具和服务器端脚本。而npm(Node Package Manager)则…...
Typora 最新版本下载安装教程(附详细图文)
文章简介 在当今快节奏的信息化时代,简洁高效的写作工具成为了每位内容创作者的必需品。而Typora,这款备受推崇的 Markdown 编辑器,正是为此而生。它采用无缝设计,去除了模式切换、预览窗口等干扰,带来真正的实时预览…...
将一个变量声明为全局变量比如:flag1=false;然后通过jQuery使用js一个方法,将它设置为不可修改
方法 1:使用 Object.defineProperty 通过 Object.defineProperty 将全局变量设置为只读属性。 // 声明全局变量 var flag1 false;// 使用 Object.defineProperty 将其设置为不可修改 Object.defineProperty(window, flag1, {configurable: false, // 不允许删除属…...
找不到qt5core.dll无法运用软件的解决办法
在运行某些软件或游戏时,部分用户会遇到电脑显示由于找不到qt5core.dll,无法继续执行代码的问题,下面就给大家分享几种简单的解决方法,轻松恢复软件正常运行。 导致qt5core.dll缺失的原因 qt5core.dll是 Qt 应用程序框架的一部分…...
集线器,交换机,路由器,mac地址和ip地址知识记录总结
一篇很不错的视频简介 基本功能 从使用方面来说,都是为了网络传输的标识,和机器确定访问对象 集线器、交换机和路由器 常听到路由器和集线器,下面是区别: 集线器 集线器:一个简单的物理扩展接口数量的物理硬件。…...
Javascript算法——回溯算法(组合问题)
相关资料来自《代码随想录》,版权归原作者所有,只是学习记录 回溯 回溯模板 void backtracking(参数) {if (终止条件) {存放结果;return;}for (选择:本层集合中元素(树中节点孩子的数量就是集合的大小)) {处理节点…...
【人工智能机器学习基础篇】——深入详解无监督学习之聚类,理解K-Means、层次聚类、数据分组和分类
深入详解无监督学习之聚类:如K-Means、层次聚类,理解数据分组和分类 无监督学习是机器学习中的一个重要分支,旨在从未标注的数据中发现潜在的结构和模式。聚类(Clustering)作为无监督学习的核心任务之一,广…...
从0到机器视觉工程师(二):封装调用静态库和动态库
目录 静态库 编写静态库 使用静态库 方案一 方案二 动态库 编写动态库 使用动态库 方案一 方案二 方案三 总结 静态库 静态库是在编译时将库的代码合并到最终可执行程序中的库。静态库的优势是在编译时将所有代码包含在程序中,可以使程序独立运行&…...
Mybatis的set标签,动态SQL
set标签常用于update语句中,搭配if标签使用 set标签的作用 1、会动态加上前置set关键字 2、可以删除无关的逗号 示例代码: <update id"update">update employee<set><if test"name ! null">name #{name},<…...
机器学习-感知机-神经网络-激活函数-正反向传播-梯度消失-dropout
文章目录 感知机工作流程 神经网络区别各种各样的神经网络 激活函数激活函数类型Sigmoid 函数ReLU函数Leaky ReLU 函数Tanh 函数 正向传播反向传播梯度消失(gradient vanish)如何解决 Dropout使用 PyTorch实战神经网络算法(手写MNIST数字识别)viewsoftmax和log-softmaxcross-en…...
HTML5 时间选择器详解
HTML5 的时间选择器(Time Picker)允许用户通过图形界面选择时间。它通过设置 <input> 元素的 type 属性为 time 来实现。以下是关于 HTML5 时间选择器的详细讲解。 HTML5 时间选择器详解 1. 基本用法 要创建一个时间选择器,只需使用…...
SSM-Spring-AOP
目录 1 AOP实现步骤(以前打印当前系统的时间为例) 2 AOP工作流程 3 AOP核心概念 4 AOP配置管理 4-1 AOP切入点表达式 4-1-1 语法格式 4-1-2 通配符 4-2 AOP通知类型 五种通知类型 AOP通知获取数据 获取参数 获取返回值 获取异常 总结 5 …...
小红书笔记详情API分析及读取深度探讨
一、引言 随着社交电商的蓬勃发展,小红书凭借其独特的社区氛围和强大的内容生产能力,吸引了大量用户和开发者。对于开发者而言,小红书提供的API接口是获取其丰富内容的重要途径。本文将对小红书笔记详情API进行深入分析,并详细阐…...
【Yarn】通过JMX采集yarn相关指标的Flink任务核心逻辑
通过JMX采集yarn相关指标的Flink任务核心逻辑 文章目录 通过JMX采集yarn相关指标的Flink任务核心逻辑通过jmx接口查询Yarn队列指标请求JMX配置项核心处理流程输出到kafka格式通过jmx接口查询ResourceManager核心指标请求JMX读取配置yaml配置文件核心处理逻辑输出Kafka格式彩蛋 …...